View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John[_88_] John[_88_] is offline
external usenet poster
 
Posts: 205
Default Custom menu problems

Hi Andrew,

If it's just for a particular workbook, then place the code for the menu in
a workbook open event (double click the "ThisWorkbook" element in VBE window
and select "Workbook" from the left-hand drop down box). This should iniate
the menu as the workbook opens, plus the menu code will be embedded in that
workbook. You then just need to add a "remove menu" procedure to the Close
event (select this from the right-hand drop-down).

Something like this (where Add and Remove is your code):

Private Sub Workbook_Open()
Call AddCustomMenu
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call RemoveCustomMenu
End Sub

Hope it helps.

John


"Andrew Fletcher" wrote in message
om...
Hi folks. Can anyone shed some light on the behaviour of custom menu
items? I have created a menu called 'Add plant'. THis sits to the
right of the 'Help' menu on the top line of the window. IT has drop
down menus to which I have added sub menu items to which I have
attached macros.

The menu is only specific to a particular work book and has no meaning
otherwise. I therefore only want to load this menu when I am using the
specific workbook. The other problem is if I use my workbook on
another PC the menu is not present.

Perhaps I am using the wrong feature for the job in hand bould would
appreciate any assistance or advice.

Thx

Andy F