Customizing a menu bar...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
In your events, make the visibility of the menu dependent on the name of the
workbook: use ActiveWorkbook.Fullname or ActiveWorkbook.Name
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top