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: 3
Default Closing Hidden Workbook when Active Workbook is Closed

Data.xls is a shared workbook which, when opened, also opens View.xls via the
following:

Private Sub Workbook_Open()
Workbooks.Open Filename:="C:\My Documents\TestBook\View.xls", updateLinks:=0
ActiveWorkbook.UpdateRemoteReferences = False
Workbooks("View.xls").Worksheets("Sheet1").Activat e
Windows("Data.xls").Activate
ActiveWindow.Visible = False
End Sub

Data.xls remains hidden to the user throughout the session.
View.xls has 6 protected worksheets, linked to Data.xls, and is nothing more
than a user interface, allowing the user to input to and sort the information
on Data. xls, all of which is done through macros.

All of the above works fine. The problem I'm having is finding a means of
closing Data.xls when the user closes View. xls.

Currently the following is in View.xls:

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

This results in Run-time error 9 Subscript out of range.

Both workbooks need to close, without saving, when View.xls is closed.
After numerous variations of activating & closing windows, workbooks, etc. I
am at my (admittedly limited) wits end.
Any help would be greatly appreciated.
Susan



 
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
Consolidation of data from cell in active sheet of closed workbook Neil X Peel Excel Worksheet Functions 3 March 8th 07 02:35 PM
Error on closing a hidden workbook BeSmart Excel Programming 3 September 23rd 05 01:41 AM
Closing a workbook and printing a non-active page Sleeping Bear[_2_] Excel Programming 4 August 5th 05 01:47 PM
hidden names in active workbook hamcdo Excel Worksheet Functions 2 June 1st 05 05:46 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM


All times are GMT +1. The time now is 05:19 AM.

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"