Author Topic: (Challenge) Emulate right click menu in VBA  (Read 2678 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16727
  • Superior Stupidity at its best
(Challenge) Emulate right click menu in VBA
« on: September 22, 2004, 11:48:10 PM »
Ok, this is another little functionality that SHOULD have been included in VBA but for some reason MS saw fit to exclude it from the mix....

Your task ...
Emulate a popup menu for a right click event in a user form.

Rules are ....

Popup menu must NOT be simply another form
no API calls are allowed
Popup must appear when right click on form and disappear when clicking on an item in the popup menu or when clicking on the form.

It can be done....but how?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

MP

  • Seagull
  • Posts: 17496
(Challenge) Emulate right click menu in VBA
« Reply #1 on: September 23, 2004, 12:11:56 AM »
You could trap the right mouse button up event and then move a control (that's current not visible) to the appropriate coords, set the visible property to true, hiding as appropriate per your latter event descriptions but who would want to do this? Why not just code up a dll that sports the kind of functionality you want instead of trying to duct tape a solution onto anemic vba? I'm all for stretching ones mind, but I just can't see myself wanting or needing to code a solution like this when there are tools available to do it so easily.

/scrooge.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16727
  • Superior Stupidity at its best
(Challenge) Emulate right click menu in VBA
« Reply #2 on: September 23, 2004, 12:17:59 AM »
Yeah ... be a scrooge ...
[sarcasm]
Ok...so tell me...what IS the API call in VBA for a popup menu?
[/sarcasm]
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

MP

  • Seagull
  • Posts: 17496
(Challenge) Emulate right click menu in VBA
« Reply #3 on: September 23, 2004, 12:41:21 AM »
Can't rightly tell you, I rarely use VBA. I would start by searching MSDN, like this link.

I use VB a reasonable amount, thus the dll suggestion. I tried VBA when AutoCAD first started to sport it and just went, "Yeck, why'd they make it so wimpy?"

I know, I know: So you'd buy VB if you wanted to do any serious programming. It is cheap compared to the wheel spinning time you spend jury rigging things onto VBA.

Your mileage may vary.

Good night folks. :)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox