Help - VBA Code execution in Excel

  • Thread starter Thread starter Luis
  • Start date Start date
L

Luis

Can someone help me with the "How to" trigger a VBA code to set up a
menu if a particular workbook is opened?

The reason that I need this code is that I have a workbook that is
generate every week and would like to be able to generate a custom
menu that every time that this particular workbook is open is generate
a custom menu.

The only way that I can do this is by adding the vba code in
ThisWorkbook but because it is generate everytime the code is
override.

Suggestions please.

Luis
 
Louis,
Properly controlling a custom menu is rather complex. You need to set
things up to create the menu when the workbook is Opened or Activated, and
the menu must be destroyed when the workbook is Closed or Deactivated.

If the menu is to be associated only with certain worksheets in the
workbook, you also have to create/destroy the menu when those sheets are
Activated/Deactivated.

When I do it, I just set up a call to an "AddMenu" or a "ResetMenu" routine
so that I only have to write those routines once.

Contact me via eMail (remove spaces) at HelpFrom @ jlathamsite.com and I'll
send you a workbook that has demo code to show how I get it done - you can
examine the code and adapt it to your needs?
 
Back
Top