View Single Post
  #21   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Thanks Peter. Strangely, the macro seemed to work the first couple of
times, and then it stopped working. Now it only deletes the style, and
doesn't replace it. This is what I'm running:

Sub ScratchMacro()
Dim myRange As Range
Set myRange = ActiveDocument.Range
With myRange.Find
.Style = ActiveDocument.Styles("mystyle")
.MatchWholeWord = True
While .Execute
myRange.Delete
myRange.Style = "stylex"
Wend
End With
End Sub


Of course in my Word document I have both "mystyle" and "stylex"
defined in the styles.

I was also curious about how to run multiple style swaps in the same
macro -- for example, if I had a list of styles that I wanted to change
out with one click, how would I do that? Would I just include the next
macro before End Sub? I have tried that but it doesn't seem to work.
Thanks.

Tom