• Language setting

    Author
    Topic
    #466881

    Before doing a spelling check of a document, I always select all (Ctrl + A) and set the language of the whole document. However, this does not seem to affect text boxes. How can I select a whole document and apply the same language setting to all the text in the document *including any text boxes*?

    Viewing 3 reply threads
    Author
    Replies
    • #1210638

      Another thing to check is the language of your normal.sty, or any other styles that might affect text in text boxes, tho I make no promises that you’ll find anything there (sorry!).

    • #1210648

      How can I select a whole document and apply the same language setting to all the text in the document *including any text boxes*?

      How about a macro?

      Code:
      Sub AssignEnglishUS()
      Dim shp As Word.Shape
      With ActiveDocument
          .Content.LanguageID = wdEnglishUS
          For Each shp In .Shapes
              If shp.TextFrame.HasText Then
                  shp.TextFrame.TextRange.LanguageID = wdEnglishUS
              End If
          Next
      End With
      End Sub

      I’ve overlooked the headers and footers, but hopefully those are not a problem area, since the additional code is a bit involved.

      (If you are not familiar with macros, open the Macros dialog using Alt+F8, type or paste AssignEnglishUS and click Create. Then fill in the contents between Sub and End Sub with the above code. You can run the macro from the Macros dialog, or assign it to a toolbar button.)

      == Edit ==

      I guess you will want to insert an A before US in the above. My oversight…

    • #1210793

      Thanks for your reply. I curently use the following macro to set US English (and a matching one for UK English).

      Sub US()
      ActiveDocument.Styles(“Normal”).LanguageID = wdEnglishUS
      Selection.WholeStory
      Selection.LanguageID = wdEnglishUS
      Selection.NoProofing = False
      Application.CheckLanguage = False
      End Sub

      This works on headers and footers, so I guess that appending your macro to mine will set the language everywhere (main document, headers/footers, and text boxes)?

      How can I expand your macro to disable the “no proofing” and “do not check language” options inside text boxes as in my macro above?

      • #1210837

        Thanks for your reply. I curently use the following macro to set US English (and a matching one for UK English).

        Code:
        Sub US()
            ActiveDocument.Styles("Normal").LanguageID = wdEnglishUS
            Selection.WholeStory
            Selection.LanguageID = wdEnglishUS
            Selection.NoProofing = False
            Application.CheckLanguage = False
        End Sub

        This works on headers and footers, so I guess that appending your macro to mine will set the language everywhere (main document, headers/footers, and text boxes)?

        If you combine them, you won’t need the .Content part of mine, as that refers to the main “body” area.

        How can I expand your macro to disable the “no proofing” and “do not check language” options inside text boxes as in my macro above?

        I would guess that those properties also belong to the “shp.TextFrame.TextRange” object but I have not gone back into the VBE to confirm. Hopefully you can find them there (or nearby) using the IntelliSense prompting.

    • #1210883

      Thanks for yor reply. I don’t know what the last sentence refers to, but I tried the following, and it works OK, although the “Selection.NoProofing = False” line switches off the “Do not check spelling” option everywhere except in the header/footer – do the header/footer language and proofing options need to be selected and set separately somehow?

      Code:
      Sub US()
          ActiveDocument.Styles("Normal").LanguageID = wdEnglishUS
          ActiveWindow.ActivePane.View.Zoom.Percentage = 100
          Selection.WholeStory
          Selection.LanguageID = wdEnglishUS
          Selection.NoProofing = False
          Application.CheckLanguage = False
      Dim shp As Word.Shape
      With ActiveDocument
          .Content.LanguageID = wdEnglishUS
          For Each shp In .Shapes
              If shp.TextFrame.HasText Then
                  shp.TextFrame.TextRange.LanguageID = wdEnglishUS
                  shp.TextFrame.TextRange.NoProofing = False
              End If
          Next
      End With
      End Sub
      • #1211024

        do the header/footer language and proofing options need to be selected and set separately somehow?

        In many cases, yes, that’s why I disclaimed responsibility for them in my earlier post.

        There are examples here in the Lounge of how to loop through all the headers and footers in code; hopefully the new search engine will turn those up.

    Viewing 3 reply threads
    Reply To: Language setting

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: