Quote:
Originally Posted by ashalles135
I tried the macro you posted, and was patient for a while, but it seemed to just be locked up. So I ended the task and when I opened up the test file again, it had hundreds of "(U) "s in the table of contents. But nothing in the text.
|
You didn't mention a Table of Contents before. Moreover, what you did say was
Quote:
Originally Posted by ashalles135
Our text gets dumped out of another program and everything is styled "Normal"... including the tables.
|
which rules out the presence of a Table of Contents; The presence of a Table of Contents also suggests your document has Heading Styles - which you also didn't mention...
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[!^13]@^13"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.Style = wdStyleNormal
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
If .Information(wdWithInTable) = False Then
Select Case .Characters.First
Case Chr(32), vbCr
Case Else: .InsertBefore "(U) "
End Select
Else
.End = .Tables(1).Range.End
End If
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub