M
MarieJ
Each user in our company has a normal.dot that contains the standard styles,
plus additional styles the user may have created.
I need a macro that copies all of the styles from the normal.dot into the
active document when the attached template is not normal.dot and I can't
change it to normal.dot.
I have seen similar requests, but those requests seem to be for
specifically-named styles. I have no control over how users name the styles
in their normal.dot.
My thought is to use a For Each...Next loop pointing to the styles in the
normaldot, and then I need to define and use a variable for each style name.
Here is my attempt. But it doesn't like the NormalTemplate.Styles part. I
don't know how to get it to go through all the styles in normal.dot instead
of activedocument.styles (which works fine). Can someone help me? TIA
MarieJ
Sub CopyNormalStyles()
Dim fileName As String
Dim tmpName As String
Dim myStyle as Style
Dim strStyleName as String
tmpName = NormalTemplate.FullName
fileName = ActiveDocument.FullName
'Need a For Each line here so it cycles through all the styles in
Normal.dot
For Each myStyle In NormalTemplate.Styles 'this doesn't work
strStyleName = myStyle.NameLocal
Application.OrganizerCopy Source:=tmpName, _
Destination:=fileName, Name:=strStyleName, _
Object:=wdOrganizerObjectStyles
Next
End Sub
plus additional styles the user may have created.
I need a macro that copies all of the styles from the normal.dot into the
active document when the attached template is not normal.dot and I can't
change it to normal.dot.
I have seen similar requests, but those requests seem to be for
specifically-named styles. I have no control over how users name the styles
in their normal.dot.
My thought is to use a For Each...Next loop pointing to the styles in the
normaldot, and then I need to define and use a variable for each style name.
Here is my attempt. But it doesn't like the NormalTemplate.Styles part. I
don't know how to get it to go through all the styles in normal.dot instead
of activedocument.styles (which works fine). Can someone help me? TIA
MarieJ
Sub CopyNormalStyles()
Dim fileName As String
Dim tmpName As String
Dim myStyle as Style
Dim strStyleName as String
tmpName = NormalTemplate.FullName
fileName = ActiveDocument.FullName
'Need a For Each line here so it cycles through all the styles in
Normal.dot
For Each myStyle In NormalTemplate.Styles 'this doesn't work
strStyleName = myStyle.NameLocal
Application.OrganizerCopy Source:=tmpName, _
Destination:=fileName, Name:=strStyleName, _
Object:=wdOrganizerObjectStyles
Next
End Sub