S
Steve Finlayson
I have a macro that inserts paragraphs in a series of pictures to
seperate them and then goes back and inserts the caption for the
figures. Because the number of figures is variable, I would like to
set up the macro to loop until the last figure is reached.
How can I do this?
The code I am using to enter th paragraphs is as follows with the
last 3 lines repeating to the end of the graphics:
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToFirst, Count:=1,
Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Then I return to the first graphic and insert the captions with this
code, again repeating the last 3 lines to the end of the graphics:
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToFirst, Count:=1,
Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.InsertCaption Label:="Figure", TitleAutoText:="",
Title:="", _
Position:=wdCaptionPositionBelow
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.InsertCaption Label:="Figure", TitleAutoText:="",
Title:="", _
Position:=wdCaptionPositionBelow
I appreciate any help. Thanks
Steve
seperate them and then goes back and inserts the caption for the
figures. Because the number of figures is variable, I would like to
set up the macro to loop until the last figure is reached.
How can I do this?
The code I am using to enter th paragraphs is as follows with the
last 3 lines repeating to the end of the graphics:
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToFirst, Count:=1,
Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Then I return to the first graphic and insert the captions with this
code, again repeating the last 3 lines to the end of the graphics:
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToFirst, Count:=1,
Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.InsertCaption Label:="Figure", TitleAutoText:="",
Title:="", _
Position:=wdCaptionPositionBelow
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.InsertCaption Label:="Figure", TitleAutoText:="",
Title:="", _
Position:=wdCaptionPositionBelow
I appreciate any help. Thanks
Steve