MouseDown event constants

djreiswig

Well-known Member
Joined
Mar 13, 2010
Messages
523
Anybody know what the constants are for the mouse buttons for the mousedown event on an activex textbox? According to the help file they should be:

fmButtonLeft
fmButtonRight
fmButtonMiddle

but these all show a value of empty. I tried changing the fm to xl with the same results. I know I can just use 1,2 or 4, but I like using the constants. It makes things easier to read.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Good, I'm not the only one. If I put the code in the mouseup it works fine, but it is a little strange for the form to not show up until the button is released.

If you use the BeforeRightClick event on the sheet, the event is fired when the button is pressed down. I would like something similar to happen on the textbox, for a consistent function.

Your workaround should work, but I wonder if that variable could get off and mess things up so you have to click twice to make it work.

Is it triggering the Control and the Form>Control? Try putting a dummy Sub in the UserForm
Code:
Private Sub UserForm1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'Do nothing
End Sub
 
Upvote 0
The textbox isn't on a userform, it is on a worksheet. The worksheet doesn't have a mousedown event.
 
Upvote 0

Forum statistics

Threads
1,216,128
Messages
6,129,030
Members
449,482
Latest member
al mugheen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top