ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Before Close on "This Workbook" (https://www.excelbanter.com/excel-programming/273729-re-before-close-workbook.html)

Doug Glancy[_2_]

Before Close on "This Workbook"
 
You might try using "activate" and "deactivate" events instead of, or along
with, "open" and "beforeclose."

The reason that you don't get two versions of the menu might be that your
CreateMenu sub calls it's DeleteMenu sub at the beginning.

hth

Doug

"Bruce Roberson" wrote in message
...
I am using a version of J Walkenbach's menumaker.xls in
many of my spreadsheets. Each menu is similar in the
various workbooksbut but each workbook has its only Menu
Sheet with differences depending on the needs in that
particular workbook.

In the case where I have 2 or more workbooks open at the
same time, where this menu name "Revenue Menu" is in the
Menu sheet, I need to alter the before close method to
figure out if there is a still a spreadsheet open that has
called this createmenu in the Workbook_Open methods.

For example, workbook A is open, and I open Workbook B
which also has a "Revenue Menu" in its menu sheet page.
For some reason, I don't recall seeing two versions of
this menu up in the case where 2 or more workbooks come
open. But when I close workbook A in this case, it deletes
the "Revenue Menu" from the menubar. Then if I still need
the menu for Workbook B, then I have to go back to the
Menu Sheet page of that Workbook and click the button to
re-do the Menu.

Is there some code in the Workbook_Code method that might
alleviate this problem?



Private Sub Workbook_Open()
Call CreateMenu
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteMenu
End Sub





All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com