I am looking for the VBA code to open workbook#2 upon opening workbook#1. Then hide workbook#2. And then unhide workbook#2 when closing workbook#1.
This code is opens workbook#2 but then I get a Run-time error '9': Subscript out of range
Private Sub Workbook_Open()
Workbooks.Open filename:= _
"\\drysdale\Finance\Zias\Finspt\Financials\_QUERIES\Contract Value & Funding (billing level formulas).xlsm"
Windows("Contract Value & Funding (billing level formulas).xlsm").Visible = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Windows("Contract Value & Funding (billing level formulas).xlsm").Visible = False
Workbooks("Contract Value & Funding (billing level formulas).xlsm").Close savechanges:=True
End Sub
This code is opens workbook#2 but then I get a Run-time error '9': Subscript out of range
Private Sub Workbook_Open()
Workbooks.Open filename:= _
"\\drysdale\Finance\Zias\Finspt\Financials\_QUERIES\Contract Value & Funding (billing level formulas).xlsm"
Windows("Contract Value & Funding (billing level formulas).xlsm").Visible = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Windows("Contract Value & Funding (billing level formulas).xlsm").Visible = False
Workbooks("Contract Value & Funding (billing level formulas).xlsm").Close savechanges:=True
End Sub