-
Topic
-
Hi!
could someone give me a simple example, how to search & replace in a word dokument?i can open the right word document, but i get an error, when i want to replace..
[snippet]
function OpenWord()OpenWord = TRUE
On error resume next
Set iWord = GetObject(“Word.Application”)
if IsEmpty(iWord) then
Set iWord = CreateObject(“Word.Application”)
if IsEmpty(iWord) then
Call MsgBox(“text”, vbCritical, CAPTION)
OpenWord = FALSE
end If
end if
iWord.visible = true
iword.Documents.open(DOCPATH)
s = iword.ActiveDocument
iword.documents.item(1).Content.Find.Execute FindText=”%1″, ReplaceWith=”Argl” ,Replace=WdReplace.wdReplaceAll
iword.documents.item(1).save
iword.documents.item(1).closeend function
[/snippet]the error i get is following:
Wrong number of arguments, or invalid Property(association)
(as usual its a translation
Thx in Advance
Greez Tom
- You must be logged in to reply to this topic.