W
windsurferLA
Inhibiting cross spreadsheet custom-menu functionality.
Workbook "A" installs custom menu items when it is opened, and removes
them when closing. If another workbook "B" is opened while "A" is also
open, the custom menu items appear in workbook "B." Inadvertently
selecting a custom menu item intended for workbook "A" from workbook "B"
leads to a "run time error" which would confuse an uneducated user.
How might I best prevent the macros designed for Workbook "A," Worksheet
"A-A" from running other than when Worksheet "A-A" is active? I expect
that I could place a test at the beginning of every macro that would
stop the process if ActiveSheet.value <> "Worksheet A" where "Worksheet
A" is the name of the worksheet for which the macros are designed.
However, I have nearly 200 macros, and I'm not anxious to have to
manually insert the code at the top of each of those 200 macros.
I possibly could do a global substitution , substituting ( ) + macro
code + ( ) for the ( ) that appears at the head of each macro. Can
anyone suggest a more elegant approach.
Workbook "A" installs custom menu items when it is opened, and removes
them when closing. If another workbook "B" is opened while "A" is also
open, the custom menu items appear in workbook "B." Inadvertently
selecting a custom menu item intended for workbook "A" from workbook "B"
leads to a "run time error" which would confuse an uneducated user.
How might I best prevent the macros designed for Workbook "A," Worksheet
"A-A" from running other than when Worksheet "A-A" is active? I expect
that I could place a test at the beginning of every macro that would
stop the process if ActiveSheet.value <> "Worksheet A" where "Worksheet
A" is the name of the worksheet for which the macros are designed.
However, I have nearly 200 macros, and I'm not anxious to have to
manually insert the code at the top of each of those 200 macros.
I possibly could do a global substitution , substituting ( ) + macro
code + ( ) for the ( ) that appears at the head of each macro. Can
anyone suggest a more elegant approach.