ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Customizing a menu bar... (https://www.excelbanter.com/excel-programming/359794-customizing-menu-bar.html)

ALEX

Customizing a menu bar...
 
Exel Helper

I am building an Excel spreadsheet and want to add a new menu item of the
menu bar. I have manged to do this ok.

The issue is that whenever I open another Excel workbook the same menu bar
appears. I want the menu bar to be spcecific to one workbook only.

In my my workbook and used the Workbook_Open event and Workbook_BeforeClose
event to add and delete the menu item when the workbook was opened and closed.

I assumed that this would menu that the new menu bar only appears in that
workbook. However, if I have that workbook open, and then open an new Excel
workbook, then the new workbook 'inherits' the new menu bar too.

How can I get around this? I know that if you make changes to toolbars then
they will be saved and be 'permanent' in Excel. However, if I use the event
handlers in a given workbook I thought that would confine the changes in a
menu bar to that workbook only?

Regards


Alex

AA2e72E

Customizing a menu bar...
 
In your events, make the visibility of the menu dependent on the name of the
workbook: use ActiveWorkbook.Fullname or ActiveWorkbook.Name

"Alex" wrote:

Exel Helper

I am building an Excel spreadsheet and want to add a new menu item of the
menu bar. I have manged to do this ok.

The issue is that whenever I open another Excel workbook the same menu bar
appears. I want the menu bar to be spcecific to one workbook only.

In my my workbook and used the Workbook_Open event and Workbook_BeforeClose
event to add and delete the menu item when the workbook was opened and closed.

I assumed that this would menu that the new menu bar only appears in that
workbook. However, if I have that workbook open, and then open an new Excel
workbook, then the new workbook 'inherits' the new menu bar too.

How can I get around this? I know that if you make changes to toolbars then
they will be saved and be 'permanent' in Excel. However, if I use the event
handlers in a given workbook I thought that would confine the changes in a
menu bar to that workbook only?

Regards


Alex


Bob Phillips[_6_]

Customizing a menu bar...
 
Put the menu build in the main workbook's Workbook_Activate event, and
remove it in the Deactivate event.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Alex" wrote in message
...
Exel Helper

I am building an Excel spreadsheet and want to add a new menu item of the
menu bar. I have manged to do this ok.

The issue is that whenever I open another Excel workbook the same menu bar
appears. I want the menu bar to be spcecific to one workbook only.

In my my workbook and used the Workbook_Open event and

Workbook_BeforeClose
event to add and delete the menu item when the workbook was opened and

closed.

I assumed that this would menu that the new menu bar only appears in that
workbook. However, if I have that workbook open, and then open an new

Excel
workbook, then the new workbook 'inherits' the new menu bar too.

How can I get around this? I know that if you make changes to toolbars

then
they will be saved and be 'permanent' in Excel. However, if I use the

event
handlers in a given workbook I thought that would confine the changes in a
menu bar to that workbook only?

Regards


Alex





All times are GMT +1. The time now is 10:25 AM.

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