Quote:
Originally Posted by totoMSOF
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