Changing the language in Microsoft Word or Powerpoint

Hello, I'm trying to build a macro to change the spell checking language in Word or Powerpoint. The macro successfully gets to the Tools > Language... menu, but I can't figure out how to select the language from the pulldown list that then appears. I've tried using keystrokes, such as "F", which highlights Finnish (the first language starting with "F" in the alphabetic sequence) followed by few down keystrokes to get to French. But this is unpredictable because the most recent languages show at the top of of the pulldown list and the "F" may hit something there instead, or it may hit French, but then the down keystrokes go to something else. Is there another action that would better deal with selecting the language in the pulldown list? I noticed that if you type the language name in full very quickly, that works, but I don't know how to replicate this in KM. Insert text by typing didn't work.

1 Like

Since this task is wholly within the target MS app, I would use VBA to achieve this.
In MS Word, for example, just record a VBA macro, going through the manual steps to change language, and assign it a keyboard shortcut. You can easily edit the VBA macro if need be.

Do the same in PowerPoint.

Questions?

Thank you. That makes good sense. My only question is the following. I believe the amount by which you need to scroll down the language drop down list is variable depending how many recently used languages are inserted at the top. So when I replay the macro, I assume it will go to the last location based on its offset from the top of the list. Any suggestions on editing the VBA to make sure it "lands" on the desired language every time (I'm a novice VBA programmer so forgive me if this isn't a good question).

In VBA you wouldn't target a specific location in a list or dropdown, you assign the value directly.

Like, here's a quick macro I recorded in Word 16.20 to change the language of a document to Danish:

Sub Macro2()
    Selection.LanguageID = wdDanish
    Selection.NoProofing = False
    Application.CheckLanguage = True
End Sub

You would just need to change the LanguageID to whatever language you wanted it to be.

Then, as @JMichaelTx suggests, assign it a keyboard shortcut and you're good to go.

1 Like