S
Steved
Hello from Steved
When I run the macro in "Step Mode" it works as it should.
There are 2 Paragraphs
The first Paragraph is to be boxed
The second paragraph is to replace dashes with nothing
My issue is when I got to run it, it only does the first only, Where should
the "Do" be placed please or is their another answer. Thanks
Sub Boxed()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Race"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=vbTab
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do
Selection.Find.Execute
If Selection.Find.Found Then
Selection.Find.ClearFormatting
With Selection.Find.Font
Selection.Font.Name = "Arial Black"
.Size = 18
.Bold = True
.Color = wdColorRed
End With
With Selection.Find
.Text = "^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
With Selection.Font
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorLightYellow
End With
With .Borders(1)
.LineStyle = wdLineStyleDouble
.LineWidth = wdLineWidth150pt
.Color = wdColorAutomatic
End With
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleDouble
.DefaultBorderLineWidth = wdLineWidth150pt
.DefaultBorderColor = wdColorAutomatic
End With
Selection.Font.Color = wdColorRed
Selection.Font.Size = 18
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveDown Unit:=wdLine, Count:=3
End If
Loop While Selection.Find.Found
End Sub
When I run the macro in "Step Mode" it works as it should.
There are 2 Paragraphs
The first Paragraph is to be boxed
The second paragraph is to replace dashes with nothing
My issue is when I got to run it, it only does the first only, Where should
the "Do" be placed please or is their another answer. Thanks
Sub Boxed()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Race"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=vbTab
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do
Selection.Find.Execute
If Selection.Find.Found Then
Selection.Find.ClearFormatting
With Selection.Find.Font
Selection.Font.Name = "Arial Black"
.Size = 18
.Bold = True
.Color = wdColorRed
End With
With Selection.Find
.Text = "^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
With Selection.Font
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorLightYellow
End With
With .Borders(1)
.LineStyle = wdLineStyleDouble
.LineWidth = wdLineWidth150pt
.Color = wdColorAutomatic
End With
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleDouble
.DefaultBorderLineWidth = wdLineWidth150pt
.DefaultBorderColor = wdColorAutomatic
End With
Selection.Font.Color = wdColorRed
Selection.Font.Size = 18
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.TypeText Text:=" "
Selection.MoveDown Unit:=wdLine, Count:=3
End If
Loop While Selection.Find.Found
End Sub