Which line crashes? When it "crashes" is there an error message? (If so, knowing what the message is would be a really helpful piece of information to include...)
Your code would benefit enormously from formatting. To wit:
Code:
Sub tagBold()
ActiveDocument.Tables(1).Select
With Selection.Find ' ActiveDocument.Content.Find
.Forward = True
.Font.Bold = True
.Execute
While .Execute
.Parent.Text = "<b>" & .Parent.Text & "</b>"
Wend
End With
End Sub
I really don't see what this code does. You use .Find instead of .Replace, so all it would seem to do if working as written is find every occurence (taking no additional action), then run off the end.
I'm really not clear on what Selection.Find.Parent.Text does...
Help says:
Quote:
quote:Parent Property
Returns the parent object of the specified object. Read-only.
|
The .Parent property has no properties (such as .Text).
Help additionally provides the following example:
Code:
With Selection.Find
.Text = "hi"
.ClearFormatting
.Replacement.Text = "hello"
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceOne, Forward:=True
End With