Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The Microsoft Word Document.Save() method acting up
Message
From
26/02/2001 03:08:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/02/2001 17:58:27
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00479346
Message ID:
00479408
Views:
30
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform