Error on closing a hidden workbook
Hi all
I have an excel template that sources it's validation lists from a separate
workbook ("Masterlist.xls") which automatically opens and hides when the
template is opened. eg:
==============================================
Sub auto_open()
Application.ScreenUpdating = False
Workbooks.Open ("D:\Masterlist.xls")
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub
==============================================
I now need a "BeforeClose" code to automatically close the hidden workbook
"Masterlist.xls" (without saving changes), when the template is closed.
I tried this code, but I got a Compile error "Sub or Function not defined"
msg on the row marked with the below.
============================================
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Schedule").Select
Range("a1").Select
Workbook("MasterList.xls").Visible = True
ActiveWindow.Close False
End Sub
=======================================
Thank for your help
BeSmart
|