Share via

VBA to copy normal.dotm Styles to open document

Anonymous
2019-10-25T21:35:15+00:00

I know how to import all the styles from the normal.dotm by using the organizer, but how can I do this thru VBA?  I've googled search but can't seem to find this one.

  1. Open Style Window 9Alt + Ctrl + Shift + S).
  2. Select Manage Styles (At the bottom of the window, its the third icon from the left).
  3. Select Import/Export.
  4. Load your Normal.dotm in the left side of the window.
  5. Load your SomeDoc.dotm in the right side of the window.
  6. Select the Styles which you wan to copy from the left window(in Normal.dotm).
  7. Select Copy.
Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2019-10-25T23:07:05+00:00

Use the following code

ActiveDocument.AttachedTemplate = "Normal.dotm"

ActiveDocument.UpdateStyles

Was this answer helpful?

3 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Charles Kenyon 167.7K Reputation points Volunteer Moderator
2019-10-26T00:10:38+00:00

If your attached template is a different template and you want to retain that attachment, you can use:

Sub CopyNormalTemplateStyles()

'

    Dim strCurrentTemplate As String

    Let strCurrentTemplate = ActiveDocument.AttachedTemplate.fullname

    '

    ActiveDocument.AttachedTemplate = "Normal.dotm"

    ActiveDocument.UpdateStyles

    ActiveDocument.UpdateStylesOnOpen = False

    ActiveDocument.AttachedTemplate = strCurrentTemplate

'

End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2019-10-26T02:58:12+00:00

    Thank you to both.  This worked great.

    Was this answer helpful?

    0 comments No comments