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: 15
Default Opening new workbook

I have a piece of code that someone else has written.
There is a line of code that opens another workbook
(wkBk2):

Workbooks.Open FileName:=(wkBk2)

The program does open the new workbook. The next line of
code causes a crash (Run-Time error 9):

Sheets("April").Activate

The problem arises because the "April" worksheet is NOT in
the ActiveWorkbook. It is, however, in the newly opened
workbook (wkBk2). I would expect the newly opened wkBk2
to be the active workbook (since it was just opened), but
it is not. Apparently, this program has been up and
running for over a year. Now, however, this piece of code
is causing it to crash. I would appreciate some help in
understanding why this could all of a sudden stop
running. TIA...


 
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
How do I stop blank workbook from opening when opening an existing kjg Excel Discussion (Misc queries) 3 February 12th 10 09:36 PM
when opening an Excel Workbook, another blank workbook also opens Gord Dibben Excel Discussion (Misc queries) 0 October 12th 07 09:49 PM
when opening an Excel Workbook, another blank workbook also opens spmu Excel Discussion (Misc queries) 0 October 12th 07 01:46 PM
How to make the opening of a workbook conditional upon the opening of another workbook Marcello do Guzman Excel Programming 1 December 16th 03 06:09 AM
How to make opening of workbook conditional of opening of another workbook turk5555[_2_] Excel Programming 2 December 15th 03 11:07 PM


All times are GMT +1. The time now is 09:50 PM.

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"