J
John Doue
Thanks to the kind of Helmut and Greg, I finally got the following macro
Sub MotsTect()
Dim lCnt As Long
Dim wCnt As Long
Dim rDcm As Range
Dim Mots As Long
wCnt = ActiveDocument.ComputeStatistics(Statistic:=wdStatisticWords,
IncludeFootnotesAndEndnotes:=True)
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "'"
.Replacement.Text = "'"
While .Execute
lCnt = lCnt + 1
Wend
rDcm.Start = ActiveDocument.Range.Start
.Execute Replace:=wdReplaceAll
End With
MsgBox "There are " & wCnt & " words in the document and " & lCnt & "
replacements. For a total count of " & lCnt + wCnt
End Sub
to do what I wanted. Now, I would like to improve on it and write a
variant that would copy the resulting content of the message box to the
clipboard as the same time it displays it.
I have no idea how to do that and some further help would be greatly
appreciated.
Best regards
Sub MotsTect()
Dim lCnt As Long
Dim wCnt As Long
Dim rDcm As Range
Dim Mots As Long
wCnt = ActiveDocument.ComputeStatistics(Statistic:=wdStatisticWords,
IncludeFootnotesAndEndnotes:=True)
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "'"
.Replacement.Text = "'"
While .Execute
lCnt = lCnt + 1
Wend
rDcm.Start = ActiveDocument.Range.Start
.Execute Replace:=wdReplaceAll
End With
MsgBox "There are " & wCnt & " words in the document and " & lCnt & "
replacements. For a total count of " & lCnt + wCnt
End Sub
to do what I wanted. Now, I would like to improve on it and write a
variant that would copy the resulting content of the message box to the
clipboard as the same time it displays it.
I have no idea how to do that and some further help would be greatly
appreciated.
Best regards