View Single Post
 
Old 03-03-2019, 03:38 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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 totoMSOF View Post
It seems to work well for the sample I tried, with a third of my whole doc and the sumary, but it didn't work with the entire doc (e.g. too long: more than 5 minutes without stopping).
Taking more than 5 minutes is hardly evidence of "it didn't work". Inserting a DoEvents command in the loop and triggering it periodically might speed things up, though, by giving Word some breathing space for housekeeping. For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long, StrNt As String
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\(\[[!\(\[]@\][!\(]@\)"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    i = i + 1
    StrNt = .Text
    .Text = vbNullString
    .Footnotes.Add .Duplicate, , StrNt
    If i Mod 50 = 0 Then DoEvents
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote