View Single Post
  #19   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?

Peter,

The macro code you wrote works perfectly! Thanks. It's really
impressive to see all of these macros in action. I'm planning to put
them all together into a template that technical writers can easily use
to convert RoboHelp generated source material into a Word document.

I have a related question. In the following code, how would I change
the line myRange.InsertCaption Label:="Figure" to replace the
"mystyle" with another style, such as "stylex"? In other words, how do
I swap styles? (I thought it would be something like
myRange.InsertStyleRef ("stylex") but it didn't work.)

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


Also, let's say I have 15 style swaps that I want to make with one
macro. I'm assuming that i just remove the words "End Sub" from the
end, and add the additional macro code, but without the additional
macro's name (e.g., Sub ScratchMacro())?

Thanks.