A
andreas
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
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
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