Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts
    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*?

  2. #2
    Star Lounger
    Join Date
    May 2007
    Location
    Seattle, Washington, USA
    Posts
    85
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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!).

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by Murgatroyd View Post
    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...

  4. #4
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts
    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?

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by Murgatroyd View Post
    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.

    Quote Originally Posted by Murgatroyd View Post
    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.

  6. #6
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts
    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

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by Murgatroyd View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •