View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Detect Custom Menu

One way:

Dim mnMyMenu As CommandBarControl
On Error Resume Next
Set mnMyMenu = CommandBars.FindControl(Tag:="my menu")
On Error GoTo 0
If mnMyMenu Is Nothing Then
With CommandBars(1).Controls
Set mnMyMenu = .Add(Type:=msoControlPopup, _
Befo=.Count, Temporary:=True)
End With
With mnMyMenu
.Caption = "mymenu"
.Tag = "my menu"
'...
End With
End If





In article ,
"scott" wrote:

I've got my vba code creating a custom menu called "mymenu". The code only
loads the menu when certain spreadsheets open containing my criteria.

What I can't figure out is how to detect if "mymenu" has already been loaded
and if it has, don't load it a 2nd time. This happens sometimes because the
user opens up several spreads that contain my special criteria in certain
cells.

Any ideas?