Andreas Hermle
asked on
Counter for macro
Dear Experts:
below macro copies all parantheses at the end of the current document. To spruce this very handy macro up, I would like a counter integrated, that tells me via a MsgBox ...
... how many parenthetical expressions have been copied or in the case none were found
... no parentheses found in current document
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
below macro copies all parantheses at the end of the current document. To spruce this very handy macro up, I would like a counter integrated, that tells me via a MsgBox ...
... how many parenthetical expressions have been copied or in the case none were found
... no parentheses found in current document
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub CopyParentheticalExpressions()
Dim str As String
str = ""
ActiveWindow.View.ShowFieldCodes = True
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="\(*\)", MatchWildcards:=True, Forward:=True, Wrap:=wdFindStop) = True
ActiveWindow.View.ShowFieldCodes = True
str = str & Selection.range.Text & vbCr
Selection.Collapse wdCollapseEnd
Loop
End With
ActiveDocument.range.InsertAfter str
ActiveWindow.View.ShowFieldCodes = False
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> thank you very much
You are very welcome :)
I'm glad this worked for you.
You are very welcome :)
I'm glad this worked for you.
ASKER
thank you very much for your professional help. It works! Regards, Andreas