J
jezzica85
Hi everybody,
I got my macro recorded so I can replace my text, but for some reason, when
I run it, it does nothing. I know Microsoft Word has some weird bugs in it
that doesn't always show paragraph and font formatting when you replace, so I
tried to fix it and it doesn't look like I was sucessful. Anyway, can anyone
tell me where I need to fix this macro?
Thanks again!
Jezzica85
Sub Tagger()
' Replace centered, otherwise unformatted text with itself, surrounded by
[C] tags, bolded
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphCenter
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[C]^&[/C]"
.Replacement.Font.Bold = True
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace centered italicized text with itself, surrounded by [CI] tags
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphCenter
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[CI]^&[/CI]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace left aligned italicized text with itself, surrounded by [LI] tags
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[LI]^&[/LI]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace left aligned, otherwise unformatted text with itself, surrounded
by [L] tags
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[L]^&[/L]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I got my macro recorded so I can replace my text, but for some reason, when
I run it, it does nothing. I know Microsoft Word has some weird bugs in it
that doesn't always show paragraph and font formatting when you replace, so I
tried to fix it and it doesn't look like I was sucessful. Anyway, can anyone
tell me where I need to fix this macro?
Thanks again!
Jezzica85
Sub Tagger()
' Replace centered, otherwise unformatted text with itself, surrounded by
[C] tags, bolded
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphCenter
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[C]^&[/C]"
.Replacement.Font.Bold = True
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace centered italicized text with itself, surrounded by [CI] tags
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphCenter
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[CI]^&[/CI]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace left aligned italicized text with itself, surrounded by [LI] tags
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[LI]^&[/LI]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace left aligned, otherwise unformatted text with itself, surrounded
by [L] tags
Selection.Find.ClearFormatting
With Selection.Find.ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "[L]^&[/L]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub