J
John Baker
Hi:
I am having a minor syntax problem.
I wish to store the name and path of the spreadsheet I am in( which is variable), and copy
some data from a spreadsheet that has a known name and location. I am attempting to save
the file name and path of the sheet I am on, and then switch back and forth between the
two sheets using the windows.activate function. The problem is that i don't know the
correct syntax to refer to a variable in that command. The code is as follows (in part):
Application.ScreenUpdating = False
Sheets("Input").Select
installpath = ActiveWorkbook.Path
installname = ActiveWorkbook.Name
installfile = installpath &/& installname <----VARIABLE NAMED HERE
Workbooks.Open(FileName:="C:\ipt\timesheets\Timesheet.xls").RunAutoMacros _
Which:=xlAutoOpen
Sheets("input").Select
Range("C5
7").Select
Selection.Copy
Windows(installfile).Activate <<<<----THIS IS WHERE THE PROBLEM IS!
Range("C5").Select
Can someone please tell me the correct way to refer to this variable field?
Incidentally, could I have used "ActiveWorkbook.FullName" and got the whole name and path
in one command?
Thanks a lot
John Baker
I am having a minor syntax problem.
I wish to store the name and path of the spreadsheet I am in( which is variable), and copy
some data from a spreadsheet that has a known name and location. I am attempting to save
the file name and path of the sheet I am on, and then switch back and forth between the
two sheets using the windows.activate function. The problem is that i don't know the
correct syntax to refer to a variable in that command. The code is as follows (in part):
Application.ScreenUpdating = False
Sheets("Input").Select
installpath = ActiveWorkbook.Path
installname = ActiveWorkbook.Name
installfile = installpath &/& installname <----VARIABLE NAMED HERE
Workbooks.Open(FileName:="C:\ipt\timesheets\Timesheet.xls").RunAutoMacros _
Which:=xlAutoOpen
Sheets("input").Select
Range("C5

Selection.Copy
Windows(installfile).Activate <<<<----THIS IS WHERE THE PROBLEM IS!
Range("C5").Select
Can someone please tell me the correct way to refer to this variable field?
Incidentally, could I have used "ActiveWorkbook.FullName" and got the whole name and path
in one command?
Thanks a lot
John Baker