Correct Useage of .FindControls
You would only qualify myThing5 with Thisworkbook if myThing was declared
public in the Thisworkbook module, and Thisworkbook contains the running
code.
If the popup is only to be used in your userform I would create it as needed
and destroy it immediately after, eg
' userform code
Private myThing5 As Office.CommandBar
Private Sub CommandButton1_Click()
On Error Resume Next
Application.CommandBars("test2").Delete ' just in case
On Error GoTo 0
Set myThing5 = Application.CommandBars.Add("test2", msoBarPopup, , True)
With myThing5.Controls.Add(1, , , , True)
.Caption = "my Macro"
.Visible = True
'.OnAction = "myMacro"
' etc
End With
myThing5.ShowPopup
done:
On Error Resume Next
myThing5.Delete
Exit Sub
errH:
Resume done
End Sub
Regards,
Peter t
"pgag45" wrote in message
...
meh.. if I throw in a
Private Sub cmdShowMenu_Click()
On Error Resume Next
ThisWorkbook.myThing5.ShowPopup
End Sub
if the IDE is opened... it doesn't crash, it just doesn't work..
|