By default, the ExecuteMso method is used to "press" the selected icon, e.g.
But in the case of the gallery, the above code will give the font in the active cell the color last selected in the gallery, without showing the color picker.
Another method to "press" an icon is to use a keyboard shortcut. When you press the left Alt key, you will get prompts as to what keys you need to press sequentially to trigger the icon. In the Polish language version, to display the color picker for fonts, I will use Left Alt, G, F, 1. To color the background of the cells, I will use Left Alt, G, H, 1. In the code below, adjust the key sequence according to your language version.
If you will be running the macro with a button, you can assign the TestKbd macro to it. If you will be running from the Macro window (keyboard shortcut Alt+F8), then you must call the Test macro. If you will be running this macro with a keyboard shortcut, then the Test macro should at least have this form:
and all the keys of the applied shortcut must be released before one second expires.
In theory, you could use the SendKeys method instead of winAPi keybd_event. However, the use of SendKeys on many computers causes a problem (most often the numeric keypad "freaks out") so for many years, however, I have recommended winAPI, which is more stable in execution.
Artik
Bookmarks