Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Excel to open a second workbook when opening another one

Status
Not open for further replies.

StewartUK

Programmer
Feb 19, 2001
860
GB
Sorry - struggled to think of how to write my question!

What I have is a workbook that users are used to using and a new version of it that I want them to use instead.

So what I want to do is, when the user opens the old style workbook, get Excel to open the new one automatically.

How do I do that?

Thanks,

Stewart
 



Hi,

In the Workbook_Open event of the OLD workbook, open the NEW workbook.

Skip,

[glasses] [red][/red]
[tongue]
 
....and then close the old workbook....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Er yes.

How do I do that - I ran the macro recorder and it gives me:
Workbooks.Open Filename:= _
"I:\NewFred\Bank Statement Processing\Bank Statement Credits Reconciliation.xls"

How do I get this into the Workbook_open event?

Stewart
 
In the VBE, double click on the "ThisWorkbook" icon and it will open up a module

Pick "Workbook" from the "GEneral" dropdown and it will default to the "Open" event

within the structure that is provided for you (ie before the End Sub) enter:
Code:
Workbooks.Open Filename:= _
        "I:\NewFred\Bank Statement Processing\Bank Statement Credits Reconciliation.xls"
thisworkbook.close

the Thisworkbook.close line will close down the workbook that is calling the code (ie the OLD one)

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Another way is to put the old workbook in the recycle bin ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top