Results 1 to 7 of 7

Thread: Macro to change all styles to a specific language

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Macro to change all styles to a specific language

    I'm having some difficulty with the VBA language. What I want to do is to select all Styles in a template and set them all to Canadian English. At the same time I know there might be some errors because some Styles do not have languages at all. Here is my current code

     
    Sub ChangeStyle()
        Set tempDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
        Set stylish = tempDoc.Styles
        For Each stylish In tempDoc
            stylish.LanguageID = wdEnglishCanadian
        Next
        tempDoc.Close SaveChanges:=wdSaveChanges
        ActiveDocument.UpdateStyles
    End Sub
    I'm having a rather difficult time wrapping my head around Collections and using For Each with it. If someone could help me out, that would be fantastic. I don't mind if someone gives me the answer right away, but I would also like to learn
    Last edited by Aussiebear; 01-26-2025 at 11:39 AM.

Posting Permissions

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