Is there any way I can use some generic variable FileName, entered by the user or (preferably) passed in as whatever the current filename is, to make a macro run dynamically? The macro goes between two files, taking information out of one and pasting the values into another. The only problem is that the starting filename will not be the same each time.
Below is the code I have and the second to last line shows where I would need to pass in whatever the current filename is.
'Open Output File and clear out the contents
Workbooks.Open Filename:="\\DRFSFILP3\Groups$\PMODEL\OutputForFieldSales.xls"
Windows("OutputForFieldSales.xls").Activate
ActiveWindow.WindowState = xlMaximized
Sheets("Summary1").Select
Cells.Select
Selection.Delete Shift:=xlUp
range("A1").Select
ActiveSheet.Next.Select
Cells.Select
Selection.Delete Shift:=xlUp
range("A1").Select
ActiveSheet.Previous.Select
range("A1").Select
'Copy the main summary page from New Deal Model
Windows("thisFileName").Activate
Sheets("Summary").Select
Thanks for the help.
Below is the code I have and the second to last line shows where I would need to pass in whatever the current filename is.
'Open Output File and clear out the contents
Workbooks.Open Filename:="\\DRFSFILP3\Groups$\PMODEL\OutputForFieldSales.xls"
Windows("OutputForFieldSales.xls").Activate
ActiveWindow.WindowState = xlMaximized
Sheets("Summary1").Select
Cells.Select
Selection.Delete Shift:=xlUp
range("A1").Select
ActiveSheet.Next.Select
Cells.Select
Selection.Delete Shift:=xlUp
range("A1").Select
ActiveSheet.Previous.Select
range("A1").Select
'Copy the main summary page from New Deal Model
Windows("thisFileName").Activate
Sheets("Summary").Select
Thanks for the help.