Changing the Language Setting for All Document Text

by Allen Wyatt
(last updated January 27, 2018)

2

Sharon received a document that includes many tables in it. She selected the entire document using Ctrl+A and then changed the language setting for the document. However, this did not change the language setting for any of the text contained within the tables. Sharon wonders if there is a way to really change the language setting for all text in the document.

In doing some testing, we found that if you have a document that includes tables, when you press Ctrl+A and change the language setting, those paragraphs in the table are also affected, just like regular paragraphs. The only time that this did not occur is if the table was in a "non-body" portion of the document, such as a text box, a shape, header, footer, endnotes, or footnotes. In those instances, the text in those elements was not affected.

The only way to affect each of these areas is to use a macro. For instance, here is a simple macro that will go through each of the StoryRanges in the document and change the language for each paragraph:

Sub ChangeLanguage()
    Dim r As Range
    Dim p As Paragraph

    For Each r In ActiveDocument.StoryRanges
        For Each p In r.Paragraphs
            p.Range.LanguageID = wdEnglishUK
        Next p
    Next r
End Sub

The language setting, in this macro, is set to UK English. If you would like it set to a different language—and there are scores of them—you can use one of the enumerations listed on this page:

https://msdn.microsoft.com/en-us/VBA/Word-VBA/articles/wdlanguageid-enumeration-word

For most folks, the simple macro should work just fine. If you have a more complex document, though, you may still find some areas where the language was not changed. In that case, you may find the macro at the following page helpful:

https://cybertext.wordpress.com/2011/10/14/word-macro-to-set-the-language-for-most-eleme/

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (5227) applies to Microsoft Word 2007, 2010, 2013, and 2016.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Noticeable Delays when Switching Documents

Do you notice a certain "slowness" that occurs when you switch between document windows in Word? There could be any ...

Discover More

Embedding Your Phone Number in a Document

One way you can designate your responsibility for a document is to add your phone number to it. There is no need to add ...

Discover More

Copying Print Areas when Copying Worksheets

Print areas are a great way to define what, exactly, you want to print from a worksheet. When you copy worksheets, the ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Changing between English Variants

What is the easiest way to switch between English spelling variants in a document? This tip examines a couple of ways you ...

Discover More

Specifying a Language for Text

Need to format a paragraph (or some selected text) so that it is a language other than English? You can do so easily by ...

Discover More

Keyboard Changes to Unwanted Foreign Language

There you are typing along, minding your own business, when wham! You end up in an entirely different language and you ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 + 9?

2018-01-29 03:44:35

Richard Price

If the document uses styles that are all based on one style (e.g. Normal), then you don't need any macros. All you have to do is to change the language setting of that master style (right-click on the style in the Styles gallery of the Home tab, select Modify -> Format -> Language). I tried this on a document containing a table and several text boxes, one of which contained another table, and it worked perfectly. You may need to reinitialise the spell checker (File -> Options -> Proofing -> Recheck Document) in order to see the effect of the language change on spell checking.

Of course many documents are created by people who don't understand or choose to use styles, but that shouldn't be a problem because then the whole document will be in the Normal style, in which case the above method still works. It will only fail if the original author has applied a proofing language as _direct_ formatting of content within the document. In that case, the author should be taken aside for a good talking-to.


2018-01-27 06:11:26

Ken Endacott

If there are more than one shape or textbox containing text then the macro ChangeLanguage will only change the language of the text in the first. The following macro ChangeLanguageAll will change the language for the whole document including all textboxes and shapes containing a textframe.

Sub ChangeLanguageAll()
Dim r As Range
Dim p As Paragraph
Dim aShape As Shape
Dim txtFrame As TextFrame

For Each r In ActiveDocument.StoryRanges
For Each p In r.Paragraphs
p.Range.LanguageID = wdEnglishUK
Next p
Next r
For Each aShape In ActiveDocument.Shapes
Set txtFrame = aShape.TextFrame
If Not txtFrame Is Nothing Then _
txtFrame.TextRange.LanguageID = wdEnglishUK
Next aShape
End Sub

Each paragraph has a language property that determines what language dictionary the spell checker will use to check the paragraph. When a new paragraph is created it gets its language setting from the style, thereafter the paragraph’s language can be changed to another language and it will remain until the style is re-applied or another style applied.

Language can also be applied to individual words or groups of words within a paragraph and this overrides the paragraph’s language setting for those words. They can occur if text is copied from another paragraph or another document that has a different language setting. Individual word settings will not change if the paragraph’s style is changed or renewed, the only way to remove them is by selecting the whole paragraph and setting the desired proofing language.

Language can also be applied to individual characters with curious results.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.