Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Word / May 2008



Tip: Looking for answers? Try searching our database.

replace all

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ashish Sharma - 07 May 2008 15:10 GMT
With ActiveDocument.Content.Find
   .ClearFormatting
   .Replacement.ClearFormatting
   .MatchWholeWord = True
   .Execute FindText:="Inc aa", _
       ReplaceWith:="incorporated", Replace:=wdReplaceAll
End With

if my document contains below line of code
inc aa for the [COLOR="Red"]inc aabcde [/COLOR]and incart the inc aa

the above code will replace inc aabcde also

is this a bug in ms word
John McGhie - 08 May 2008 09:05 GMT
No bug.  The  FindText:="Inc aa" is a partial string match.

Set the "Whole words only" option to True if you want an exact string match.

http://msdn.microsoft.com/en-us/library/aa213880(office.11).aspx

It's much safer to record these things with the Macro Recorder and paste the
result into your code.  Saves looking up all these weird properties :-)

Cheers

On 8/05/08 12:10 AM, in article
BBC34985-B5C6-4C49-A09E-60366467D511@microsoft.com, "Ashish Sharma"
<AshishSharma@discussions.microsoft.com> wrote:

> With ActiveDocument.Content.Find
>     .ClearFormatting
[quoted text clipped - 10 lines]
>
> is this a bug in ms word

Signature

Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group.  Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia.   mailto:john@mcghie.name

 
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.