[Intern Help] Auto close a linked workbook on exit

Status
Not open for further replies.

djmelanson

New Member
Joined
Jun 3, 2015
Messages
17
Hi guys, sorry to repost but my last title was a bit off target. I have two workbooks named Book1 and Hydro Line Stops. I created a macro that opens the Hydro Line Stops file automatically upon opening Book1. I have copied what I have so far below:

Private Sub Workbook_Open()
Workbooks.Open Filename:="\\bdl0fs05\Departments\Hydro Mechanical\Production Management\OE Open Order Status\Hydro Line Stops.lnk"
ThisWorkbook.Activate

End Sub

This works perfectly fine but I would like to also close the Hydro Line Stops file automatically when I close the Book1 workbook. I have tried:

Workbook("Hydro Line Stops.xls").close False

but I must be doing something wrong here because it comes up with a "Run-time error '9. Subscript out of range" error. Any help would be appreciated. Thanks.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Status
Not open for further replies.

Forum statistics

Threads
1,214,591
Messages
6,120,426
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top