How to move the cursor out of the comment box?

leonlai

Board Regular
Joined
Mar 22, 2019
Messages
77
Hello,

I am developing a few macros dealing with comments.

I notice that if a user happens to place (or accidentally leaves) his mouse cursor inside a comment box (e.g. after editing a comment), and then clicks on any macro button, the button does not work. He should first move his cursor out of the comment box before clicking on any macro button.

Worse, if I place the macro button in the Excel Ribbon, and the user clicks on any button while his cursor is inside a comment box, the program crashes.

Anybody has any idea how we can avoid this type of problem?

My preferred idea is that when a user clicks on any macro button, the button first checks if the cursor is inside any comment box. If yes, it will display a MsgBox "Please remove your cursor from the comment box!". How can this be done?

Alternative ideas are also welcome!

Thanks
Leon
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi, Jaafar

I did exactly what you explained.

It's incredible! It worked like a charm, whether I click a macro button on the worksheet, or a button on the Ribbon.

If I leave my cursor inside a comment box, and I click any button, the cursor jumps outside the comment box, and the clicked button fires normally.

It is exactly what I need, and I did not think it could be done as I searched a lot on the web and could not find a solution.
It now remains for me to try to understand your code, much of which is unfamiliar to me.

Thanks a lot, and Best Regards,
Leon
 
Last edited:
Upvote 0
Hi, Jaafar

It's incredible! It worked like a charm, whether I click a macro button on the worksheet, or a button on the Ribbon.
Leon

Glad it worked for you and thanks for the feedback :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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