Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Help - VBA Code execution in Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luis - 08 Sep 2007 17:42 GMT
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
JLatham - 10 Sep 2007 03:08 GMT
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?

> Can someone help me with the "How to" trigger a VBA code to set up a
> menu if a particular workbook is opened?
[quoted text clipped - 11 lines]
>
> Luis
JLatham - 10 Sep 2007 03:14 GMT
I should add that you can find a lot of info, including code examples, here:
http://www.ozgrid.com/VBA/custom-menus.htm
and Microsoft has a boatload of info here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;830502&\1Product=xlw

> Louis,
> Properly controlling a custom menu is rather complex.  You need to set
[quoted text clipped - 27 lines]
> >
> > Luis
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.