Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The Microsoft Word Document.Save() method acting up
Message
De
26/02/2001 03:08:29
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
25/02/2001 17:58:27
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00479346
Message ID:
00479408
Vues:
29
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform