Problem when opening 2nd spreadsheet with vba while in another!
I currently have a file (first.xls) open and use the following code to open a
second (second.xls):
sEventName = "Initialization"
gsWorkPath = "c:\documents and settings\me\my documents\second.xls"
Application.Workbooks.Open Filename:=gsWorkPath
This part works. My problem is now I need to read/copy the contents of a
tab in second.xls into first.xls. But now I just get "subscript out of range
error" everytime I try to work with either file.
For example, the line: ActSheet = "sheet1" gives the error
and so does: Worksheets("sheet1").Activate
How do I refer to a sheet or a workbook now? Worked fine before opening a
second one.
Thanks in advance. Sample code is MUCH appreciated.
|