Skip to content

Change Outlook’s Proofing Language on the Fly

May 11, 2012

I’m working for a company that does business in the U.S. and several other countries, and I usually attempt to ensure that my spelling is in line with who I’m communicating with. As a result, email communication often ends up looking like this:

For years I just did my best to grit my teeth and ignore it, but finally I got around to writing a macro that allows a single button-click to change the language of the email you’re working on:

Option Explicit

Private Const wdEnglishUS = 1033
Private Const wdEnglishUK = 2057

Public Sub SetLangEngUS()
	SetDocLang wdEnglishUS
End Sub

Public Sub SetLangEngUK()
	SetDocLang wdEnglishUK
End Sub

Sub SetDocLang(ALangID As Integer)
	Dim wordEditor As Object

	If Inspectors.Count = 0 Then Exit Sub
	If ActiveInspector.CurrentItem.Class <> olMail Then Exit Sub
	If Not ActiveInspector.IsWordMail Then Exit Sub
	If ActiveInspector.EditorType <> olEditorWord Then Exit Sub
	Set wordEditor = ActiveInspector.wordEditor

	On Error Resume Next
	ActiveInspector.wordEditor.Styles("Normal").LanguageID = ALangID
	ActiveInspector.wordEditor.SpellingChecked = False
End Sub

Then, just add two icons to the Quick Access Toolbar, each pointing to one of the SetLangEngUS and SetLangEngUK calls.

About these ads

From → outlook, vba

  1. andrius permalink

    Hi. Very useful macro but I get the syntax error on the 14 line. Outlook 2010. any recommendations?

  2. soundripple permalink

    Note that the last line (‘strong’) shouldn’t be in there, I’ll take it out. If it’s in your macro code, it’s probably what’s causing the error – in which case, remove it. Or is it another line causing the error?

  3. Pakete permalink

    Thanks for this macro. It is so useful. I use it in Outlook 2007 to alternate between 2 different languages and works the beginning, but then it has a little problem. It keeps changing the language, but outlook stops underlining the words that are wrong in the newle set language.

    It is strange because I can see the macro changed the language if I try to change it again without using the macro. In fact, it does not only stop undelining gramatical/spelling errors, but it also says there is nothing to check when I click on the button for the “Gramatical Check”, even though the complete text is written in a different language.

    Could it be related to ther last line of the macro:
    ActiveInspector.wordEditor.SpellingChecked = False

    Does anybody know what I could be doing wrong or what can be added to the macro to get errors underlined again?

    • Pakete permalink

      I got it working, mixing the solution proposed here, another one I found for doing the same thing on a Word document, and some indications from the Microsft Developers guide on the wordEditor property. Here is what I am using (I have only included the sub where I made the changes the rest is the same as above):
      Sub SetDocLang(ALangID As Integer)
      If Inspectors.Count = 0 Then Exit Sub
      If ActiveInspector.CurrentItem.Class olMail Then Exit Sub
      If Not ActiveInspector.IsWordMail Then Exit Sub
      If ActiveInspector.EditorType olEditorWord Then Exit Sub
      ActiveInspector.wordEditor.Windows(1).Selection.LanguageID = ALangID
      ActiveInspector.wordEditor.Windows(1).Selection.NoProofing = False
      End Sub
      Hope it helps someone….

      • soundripple permalink

        Thanks for this. I’m not sure why the macro I gave above wouldn’t work for you, unless perhaps you’re not using the Normal style (or one derived from it)? The advantage of doing it the way I did is that new text in the same document (email) should take on the language asserted by the macro; your change alters the existing text in the document (by selecting everything and applying the new language). Check the style of the text in question – is it Normal, or something that is based on Normal?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: