VBA Find and Replace in VB

L

LDaugherty

I am using a .find and .execute ReplaceWith in VB to
search for text in a Word document. My code works
perfectly on most machines but some are bombing on
the .ClearFormatting portion. Here is a portion of the
code:
WordApp.Selection.Start = 0
With WordApp.Selection.Find
.ClearFormatting
.Text = "FIND"
.Execute ReplaceWith:=""
End With

Is there some supporting file that these other machines
are missing (they have MSWORD9.OLB and it is appropriately
referenced in VB)? Has anyone even heard of this being an
issue?

Thanks
Laura
 
S

Steve Hudson

G'day "LDaugherty" <[email protected]>,

I'd be more inclined to suspect the documents rather than the
machines.


LDaugherty said:
I am using a .find and .execute ReplaceWith in VB to
search for text in a Word document. My code works
perfectly on most machines but some are bombing on
the .ClearFormatting portion. Here is a portion of the
code:
WordApp.Selection.Start = 0
With WordApp.Selection.Find
.ClearFormatting
.Text = "FIND"
.Execute ReplaceWith:=""
End With

Is there some supporting file that these other machines
are missing (they have MSWORD9.OLB and it is appropriately
referenced in VB)? Has anyone even heard of this being an
issue?

Thanks
Laura

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
C

Cindy M -WordMVP-

Hi LDaugherty,
My code works
perfectly on most machines but some are bombing on
the .ClearFormatting portion.
Please specify what you mean with "bombing". Are you
getting an error message? If yes, please quote it exactly.

Which version of Word is involved?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top