Help with code

P

papou

Hi all
WIN2K Pro
Word 2k SR1
I am encountering an error on the code below (it is executed via a VBScript)
This particular line below raises the error "Number of arguments or Property
...." (sorry cannot be sure about the english equivalent - my version is
french)
objword.Selection.Find.Execute Replace=2
I have tried Replace:=2, Replace 2, and so on, but to no avail.
Can someone please help since I cannot figure what is wrong?
TIA
Cordially
Pascal

'***** DEBUT CODE *****
Dim objword, docword
set objword = CreateObject("Word.Application")
objword.visible=true
set docword = objword.Documents.Open("C:\Documents And Settings\PARO\Mes
Documents\Test\test.doc")
With objword.Selection.Find
.Text = "Mes documents\"
.Replacement.Text = "Mes Documents\Test\"
.Forward = True
.Wrap = 1
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
objword.Selection.Find.Execute Replace=2
set objword = Nothing
 
J

Jonathan West

Hi papou

VBScript doesn't allow named arguments. As Replace is the 11th argument of
the Execute method, try this

objword.Selection.Find.Execute , , , , , , , , , , 2


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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