>I'm new to office automation so maybe somebody could help me with a little problem.
>
>I'm trying to programmatically create, alter, and save a word document… I enter in the following code at the command window…
>
>
>public oword
>oword = createobject("word.application")
>oword.visible = .T.
>oword.documents.add()
>oword.documents[1].range.text = "this is a text"
>oword.documents[1].save
>
>
>The “Save As” dialog box fires up like you would expect…
>
>Two things can go wrong here. If I click the cancel button, I get the following error.
>
>“OLE IDispatch exception code 0 from Microsoft Word: Command Failed”
>
>If I try to “Save As” to a file that already exist (I’m expecting it to overwrite the existing file) nothing happens…. The “Save” button on the “Save As” dialog box seems to do nothing.
>
>Please Help!!!
oword = createobject("word.application")
with oword
.documents.add()
.documents[1].range.text = "this is a text"
.documents[1].saveas('c:\temp\mytest.doc')
.Quit
endwith
Cetin