Open and Hide a workbook

G

Guest

How can I open Workbook 1 and have Workbook 2 automatically open and be
hidden? Then, when Workbook 1 is closed, will Workbook 2 close also?

Thank you in advance.
 
A

Ardus Petus

Paste following code into ThisWorkbook's code:

Private Sub Workbook_Open()
Dim oWB As Workbook
Set oWB = Workbooks.Open(Me.Path & "\Workbook2.xls")
oWB.Windows(1).Visible = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Workbooks("Workbook2.xls").Close False
End Sub



HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top