Dynamically change VB Macro to Project nameUpload ImagesLink Perry Shusta 3 years ago
Good Morning Richard I need some help if you would please
I have an Excel workbook that has a very detailed macro to make it work. And it does work well, I use the lessons from your Access classes to help me through it. What the code is doing is it is coping and pasting the data from the one excel workbook into another. The issue that I m having is the code has references to the workbook file name. So, if I change the workbook file name the macro, for obvious reasons ceases to work. How can I call the Project name or the file name into the code so that when I change the file name it dynamically changes the code?
Basically, any lines where the code says ("DDLTemplate.xlsm") the word Template be changing to the first initial and the last name of the driver. Example ("DDLPShusta.xlsm")
Below is a short summary of the code
'Copy & Past Pay Period End Windows("DDLTemplate.xlsm").Activate Range("D4:K4").Select Application.CutCopyMode = False Selection.Copy Windows("PayrollDetail.xlsm").Activate Range("C2:F2").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False Windows("DDLTemplate.xlsm").Activate