Help with reformatting

J

jacqueline.fulton

I am reformatting a lot of documents from our old style to new. I am
repeatedly opening the organiser, copying the styles over from our
global template into the existing template, then searching and
replacing for normal and replacing it with my new body text style. I
tried to record a macro for this but can only manage to get it to work
for the existing template name. Any tips on how to amend this macro and

replace the existing template with Active Document?

Reply »
 
D

Dave Lett

Hi,

Can you modify the following example, which is from the VBA Help file topic
":"

Dim styleLoop As Style

For Each styleLoop In ActiveDocument.Styles
If styleLoop = "SubText" Then
Application.OrganizerCopy Source:=ActiveDocument.Name, _
Destination:="C:\Templates\Template1.dot", _
Name:="SubText", _
Object:=wdOrganizerObjectStyles
End If
Next styleLoop

Then you would do something like the following to replace Normal with New
Body Text Style:
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Style = "Normal"
With .replacement
.ClearFormatting
.Text = ""
.Style = "New Body Text Style"
End With
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave


I am reformatting a lot of documents from our old style to new. I am
repeatedly opening the organiser, copying the styles over from our
global template into the existing template, then searching and
replacing for normal and replacing it with my new body text style. I
tried to record a macro for this but can only manage to get it to work
for the existing template name. Any tips on how to amend this macro and

replace the existing template with Active Document?

Reply »
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top