vb command to snap to default button

Reset

Board Regular
Joined
Apr 16, 2010
Messages
227
Is there a command to have the pointer snap to the default selection in a msgbox?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
There is a Windows setting for that so perhaps there might be an API call you can use. To find it in Windows yourself have a look at the mouse settings in Control Panel. There should be a tick box labelled "Automatically move pointer to the default button in a dialog box" or something similar.

On a related note, you can control which button is the default on a MsgBox. E.g. instead of just "vbYesNo" try "vbYesNo + vbDefaultButton2" to make No the default option. This allows you to change what happens when the user presses the ENTER key, which might be a good half-way house?
 
Upvote 0
PS - personally I'd avoid doing exactly what you propose. Some people like the mouse to do that, others don't. Those that do like it can tick the box in Control Panel (or you can show them how) so why interfere? You might just confuse the people you are trying to help!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

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