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: 28
Default Workbook_BeforeClose

To All,

I have the following working code:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
''''''''''''''''''''''''''''''''''''''''
' CleanUp CUSTOM MENU's:
''''''''''''''''''''''''''''''''''''''''
Application.CommandBars("NAVIGATE").Delete
Application.CommandBars("OVERTIME").Delete
End Sub

My problem is ... when I open (2 or more) workbooks that contain the
code, the first one I close deletes the commanbars. Which leaves the
other open workbooks unable to use the commandbars ...

How could I modify this code to:

1) Check if another open workbook(s) exists and then
2) If exists, does it need the CommandBars?

Note: If it helps ... A common thread of all the workbooks that
require the Commandbars is: a Worksheet with the name "SHIFTS" is
present.

My thoughts on this is possibly a loop to check ALL worksheets ... and
if "SHIFTS" exists 2 or more times then skip the delete since 2
workbooks must be open?

Any thoughts on how to solve this problem?

Thanks in advance ...

Jim Pellechi
 
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
Workbook_BeforeClose Ed Davis[_2_] Excel Discussion (Misc queries) 21 September 26th 09 01:01 AM
Workbook_BeforeClose Question Sashi Excel Worksheet Functions 7 July 26th 07 08:36 PM
Workbook_BeforeClose problem Amit Shanker Excel Programming 6 May 22nd 04 12:07 AM
Workbook_BeforeClose Event Shatin Excel Programming 2 January 24th 04 03:50 AM


All times are GMT +1. The time now is 05:49 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"