-----Original Message-----
Hi Stewart,
Are you trying to show a popup menu that you've created? If so, you don't
need to know the coordinates; you can use the ShowPopup method without any
arguments to show the menu.
Here's some (very ugly) code that gives you a quick overview of how you
could accomplish this. Typically, you'd want to create your menu upon
workbook open, pop it up as needed, and destroy it at workbook close.
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
On Error Resume Next
Application.CommandBars("jake").Delete
On Error GoTo 0
With Application.CommandBars.Add("jake", msoBarPopup, , True)
With .Controls.Add(msoControlPopup)
.Caption = "&Edit"
With .Controls.Add(msoControlButton)
.Caption = "&Copy"
End With
With .Controls.Add(msoControlButton)
.Caption = "&Paste"
End With
End With
.ShowPopup
End With
Cancel = True
End Sub
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
Capture mouses X&Y position on a worksheet. I want to use
the before right click option of the worksheet to display
a custom toolbar. I want to use the current position of
the mouse to set the left and top parameters for the
toolbar.
Is there a better way?
.