View Single Post
 
Old 09-25-2018, 02:25 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by ashalles135 View Post
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 View Post
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
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote