MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Need code to automatically open another workbook?


Posted by Rick M on May 09, 2001 12:43 PM

I would like to automatically open another workbook every time I open a specific workbook. The seond book I would like to open is linked to the first.
Ea. Every time I open "Pricing.xls" I would like to automatically open "Material.xls".
Thanks


Posted by Dave Hawley on May 09, 2001 1:24 PM


Hi Rick

In Pricing.xls right click on the sheet picture, top left next to file and select "View Code". Paste in this:

Private Sub Workbook_Open()
Workbooks.Open Material.xls
End Sub


You may need to include the file path if diffrent from Pricing.xls


Dave


OzGrid Business Applications

Posted by Rick M on May 09, 2001 2:53 PM

Dave I get a run-time error 424 "Object required"
The path is the same as the pricing.xls?


Posted by Rick M on May 09, 2001 2:55 PM

DAve - Iget run-time error 424 "Object required"
The path is the same as the pricing.xls?


Posted by Ivan Moala on May 09, 2001 3:19 PM


Rick try

Private Sub Workbook_Open()
Workbooks.Open "Material.xls"
End Sub


Ivan