
October 16th, 2003, 11:06 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Replacing text in MS Word from ASP
Hello
I am trying to open an MS Word document from an ASP page then use search and replace to modify the letter (e.g. name and address). I want to do this because of the control over the look and feel of the final letter.
The code I am attempting is:
set letter = CreateObject("Word.Application")
letter.Documents.Open("letter.doc")
letter.Documents(1).Content.Select
with letter.Documents(1).Selection.find
.Clearformatting
.Forward = true
.Wrap = wdWrapContinue
.Execute FindText:=strFind, Replace:=wdReplaceAll, ReplaceWith:=strReplace
end with
When I execute it I get an 'Expected Statement' error and the debugger is pointing at strFind.
What am I doing wrong?
Regards
James
|