PopUpMenu in Flexgrid - Excel2002

  • Thread starter Thread starter Nader
  • Start date Start date
N

Nader

Hello,

I'd like to know if it's possible to get a PopUpMenu with Flexgrid when
using
Excel 2002 ?

Regards,

Nader
 
Hi,

you can use a regular popup (like when right-clicking a cell) on a userform.
3 steps:
- In initialize of the Userform: create the new popup commandbar - hidden.
Call CreateMyPopup.
- In Tereminate: delete it. Call DeleteMyPopup.
- when clicking; doubleClick; or Right-Click a control, show the popup. Call
PopupMyPopup.

''' ----------------------------------------------------------
Sub CreatePopupBar()
Dim c As CommandBar
Dim cbb As CommandBarButton

''' get/create popup bar
On Error Resume Next
Set c = Application.CommandBars("MyPopup")
If Err <> 0 Then
Set c = Application.CommandBars.Add(Name:="MyPopup",
Position:=msoBarPopup, temporary:=True)
End If
On Error GoTo 0

''' add controls
Set cbb = c.Controls.Add(msoControlButton)
cbb.Caption = "submenu1"
Set cbb = c.Controls.Add(msoControlButton)
cbb.Caption = "submenu2"

End Sub

Sub DeletePopupBar()
On Error Resume Next
Application.CommandBars("MyPopup").Delete
On Error GoTo 0
End Sub

Sub PopupMyPopup()
Dim c As CommandBar
Set c = Application.CommandBars("MyPopup")
c.ShowPopup
End Sub
'''-----------------------------------------------------------
 

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

Back
Top