Custom Menu Issue (Reviving old problem)

J

jsl

I thought I had this issue resolved, but doesn't seem to work that way,
so here goes again (with a few more details)

I have some VBA code to put a new drop-down menu on the main menu bar.
I want this menu to have 6 options. Using the example in the SDK, I
wrote the following code.


If Not foundFlag Then
Set cmbNewMenu = Application.CommandBars("Menu Bar")
With cmbNewMenu.Controls
Set ctlPopup = .Add(Type:=msoControlPopup, Temporary:=True)
With ctlPopup
.Caption = "My Options"


With .Controls.Add
.Caption = "Check-Out a file"
.TooltipText = "Check Out a Schedule"
.OnAction = "CheckoutFile"
End With
With .Controls.Add
.Caption = "Check-In File"
.TooltipText = "Check in a Schedule"
.OnAction = "CheckIn_File"
End With
With .Controls.Add
.Caption = "Copy Resource Names"
.TooltipText = "Copy Resource Names to Formatted Field"

.OnAction = "CopyResourceNamestoTextField"
End With
With .Controls.Add
.Caption = "Create Successors File"
.TooltipText = "Create Excel Successors File from
Current Schedule"
.OnAction = "TraverseSucc"
End With
With .Controls.Add
.Caption = "Set Custom Flag Fields"
.TooltipText = "Set Custom Flags in Current Schedule"
.OnAction = "SetFlagsForFilteredTasks"
End With
With .Controls.Add
.Caption = "Create Logic Report"
.TooltipText = "Create Logic Report Spreadsheet"
.OnAction = "MakeLagReport"
End With
End With
End With
End If


I also set it up in as an auto-run using project_open, using the
example from JackD's website http://masamiki.com/project (see below).
This code is in the "ThisProject (<filename>)" object.

Private Sub Project_Open(ByVal pj As Project)
Application.Macro "Menus.AddMyMenuBar"
End Sub


Everything appears to work fine EXCEPT only the first 4 options of my
menu show up. The last 2 don't when the macro is run as an Auto_run
and called from project_open.

If I delete the menu and run the macro from inside the VBE, everything
works like a champ. I get the same behavior when I delete the code in
the Project_Open object and manually run the macro to add the menu
options.

Is there something strange when I have this code as an auto_run to run
via Project_open vs. inside of the VBE?
 

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

Top