LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recent security patch created problem in opening Excel Spreadsheet Vinoth Excel Discussion (Misc queries) 0 February 12th 10 01:32 PM
Opening a spreadsheet problem Excel 2007 RainyDay Setting up and Configuration of Excel 1 April 21st 09 05:25 PM
Excel 2003 problem opening existing spreadsheet [email protected] Excel Discussion (Misc queries) 4 April 29th 07 03:46 AM
opening a spreadsheet stumped New Users to Excel 2 June 10th 06 02:02 AM
excel VBA problem - setting workbook as variable & opening/re-opening safe Excel Programming 1 August 20th 04 12:22 AM


All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"