Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2005

Tip: Looking for answers? Try searching our database.

Number of Replacements?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George Lee - 07 Jul 2005 22:51 GMT
How can you get the total number of replacements after using Find/Replace
with wdReplaceAll?
Dan - 07 Jul 2005 22:56 GMT
http://word.mvps.org/faqs/macrosvba/GetNoOfReplacements.htm

> How can you get the total number of replacements after using Find/Replace
> with wdReplaceAll?
Helmut Weber - 07 Jul 2005 23:38 GMT
Hi everybody,

I wonder...:

Sub test45620()
Dim strResult As String
Dim lngResult As String
Dim l As Long
Dim oDlg As Dialog
Set oDlg = Dialogs(wdDialogEditReplace)
On Error Resume Next
oDlg.Display
strResult = Err.Description
For l = 1 To Len(strResult)
  If IsNumeric(Mid(strResult, l, 1)) Then
     lngResult = lngResult & Mid(strResult, l, 1)
  End If
Next
MsgBox "number of replacements = " & lngResult
End Sub

Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
George Lee - 02 Aug 2005 15:56 GMT
Funny, that message with the number of replacements is really an error.
However, the dialog only appears if the dialog is actually displayed? If you
access it programmatically (through VBA code), you can't get it?

> Hi everybody,
>
[quoted text clipped - 23 lines]
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"
George Lee - 08 Jul 2005 14:35 GMT
Thanks for the idea. I also saw Helmut's suggestion and although they are
both useful, they're not very elegant solutions. That's no one's fault but it
is curious what Microsoft decides to exposure and what they hide.

> http://word.mvps.org/faqs/macrosvba/GetNoOfReplacements.htm
>
> > How can you get the total number of replacements after using Find/Replace
> > with wdReplaceAll?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.