Popup Menu with Treeview

A

Andibevan

I am trying to create a popup menu that will appear using the right mouse
button.

I have added the following to the form's Load function:-
Set myBar = CommandBars.Add(, position:=msoBarPopup, _

Temporary:=True)

Set myControl = myBar.Controls _

.Add(Type:=msoControlButton)



With myControl

.FaceId = 0

.OnAction = "MySub"

End With

And then placed the following in the mouse_up event

If Button = 2 Then
myBar.ShowPopup
End If


I have 2 problems
1) If I try to set the name of the custom bar it works the first time you
load the form, but not the second, it appears to already have the commandbar
loaded and can't create a duplicate.
2) I can't get the myControl button to run the MySub sub when it is pressed?

TIA

Andi
 

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

Similar Threads


Top