MrExcel Publishing
Your One Stop for Excel Tips & Solutions

how to automatically open another work upon the opening of one workbook


Posted by Kevin Skinner on August 08, 2001 11:56 AM

I need to set something up so that when I open up workbook 'A', workbook 'B' will automatically also open up, and after workbook 'B' opens, it will switch back to workbook 'A' being the active workbook. Any way I can do this???

Thank you,
Kevin


Posted by Cory on August 08, 2001 12:09 PM

try using this code in your "This Workbook" open event:

Private Sub Workbook_Open()
ChDir "U:\hpurc2\windows\Personal\GL Posting Reports\Inventory Adjustments"
Workbooks.Open Filename:= "U:\hpurc2\windows\Personal\GL Posting Reports\Inventory Adjustments\Inventory Adjustments 2001.xls"
ActiveWindow.ActivateNext
End Sub

The "ChDir" reflects the directory the file is located in; the Workbooks.Open Filename:=" reflects the file itself including its path, and the "ActiveWindow" statement will switch you back to the original workbook...

Was that what you wanted?

Cory

Posted by Mark W. on August 08, 2001 1:39 PM

Open both workbooks. Activiate workbook 'A'.
Choose the File | Save Workspace... menu
command. Quit Excel. Now you can open both
workbooks and activate workbook 'A' by opening
the workspace. No VBA code is necessary.

Posted by Kevin Skinner on August 09, 2001 10:11 AM

Thank you


: