Counting the number of changes a macro makes
Hi fellas,
I'm very sorry to bother you again. I've spent quite a few hours trying to figure this out, but even the simple things are complicated when you're a complete novice. I've tried using the "Dim iCount As Integer" and adding various While/Wends and If/Elses etc in various parts of the macro with the message box at the end to tell me how many changes have been made but I can't get it to work.
Here's a macro to delete the red footnote numbers (and a space after them) from the main text. I've also tried different kinds of execution such as "wdReplaceOne" and putting a simple execute on a loop, but I won't clutter things up by posting numerous failed codes here. I suspect "ReplaceAll" won't be compatible with a counter (but I could be wrong about that too).
Could one of you alter this macro so that it counts the changes. Then I should be able to use that as a guide/template for any other macros.
Thanks once again for your help, and I wouldn't be asking If I hadn't already put considerable effort into figuring it out myself.
Sub DeleteFootnoteNumbers()
Selection.Find.Font.Color = wdColorRed
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^2 "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
Selection.Find.Execute Replace:=wdReplaceAll
End With
End Sub
|