MS Word: Macro to open dialogue box with specific option selected

harry888

New Member
Joined
Aug 1, 2017
Messages
5
In MS Word, I want to create a keyboard shortcut to open the "Insert Symbol" dialogue box with the Symbol font selected in the Font field.

I know how to create a keyboard shortcut to run a macro, and I have a macro with the command "Application.Dialogs(wdDialogInsertSymbol).Show", which opens the dialogue box.

However, normally when this dialogue box is opened, it has the last used font selected in the Font field. Is there a way to open this dialogue box with a specific font ("Symbol") selected in the Font field?

(A hack like 'SendKeys "%fSymb{DOWN}{ENTER}' will get the job done, but I am wondering whether there is a parameter that can set the Font field directly.)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Cross-posted at: Macro to open dialogue box with specific option selected
Please read Mr Excel's policy on Cross-Posting in rule 13: Message Board Rules


Although you can use any of .Tab, .Font, .CharNum, .CharNumLow, .Unicode, .Hint as arguments, there is no documentation on how these work or what the required parameters are.

One might expect:
VBA Code:
With Application.Dialogs(wdDialogInsertSymbol)
  .Tab = 0            'Shows first tab
  .Font = "Font Name"
  .Show
End with
to work, but it doesn't.

A workaround would be to use:

VBA Code:
With Dialogs(wdDialogInsertSymbol)
    .Tab = 0            'Shows first tab
    SendKeys "%FSymbol{TAB}"
    .Show
End With
 
Upvote 0
If I assign this macro to a shortcut key like Alt+[anything] or Alt+Shift+[anything], then it works correctly; but if I assign it to a shortcut key like Ctrl+Shift+[anything] or Alt+Ctrl+Shift+[anything], then it opens showing the second tab ('Special Characters') instead of the first tab ('Symbols'). I haven't noticed anything like this with any other macros; is it a bug, or are there restrictions on shortcut key combinations in certain cases? (Changing the macro name makes no difference.)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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