LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when closing file mmkathan Excel Discussion (Misc queries) 2 April 29th 09 05:30 PM
Error message adaytum.xla when closing workbook in Excel 2003 Laura2008 Excel Discussion (Misc queries) 1 November 5th 08 06:36 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM
EXCEL.EXE has generated an error...when closing a workbook HEIKKILÄT Excel Programming 1 September 17th 03 09:16 PM


All times are GMT +1. The time now is 04:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"