Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Word document from VFP

Status
Not open for further replies.

RichardH

Programmer
Apr 21, 2001
46
US
I am using the following code to print a Word 2000 document from VFP6.

oWord=CREATEOBJECT("Word.Basic")
oWord.FileOpen ("MyLetter.doc")
oWord.FilePrint

It prints to the default printer. Is there a way I can prompt the user to select a different printer?. Like when using the VFP command:
REPORT FORM myreport TO PRINTER PROMPT

The bigger question is where can I find the syntax for other commands like the ones above to control Word from VFP?

Thanks...Rick
 
Try oword.fileprintsetup.options

I have a somewhat old version of Office, but in it the help file is wrdbasic.hlp. Admittedly this is written for VB, but generally you can use the same commands just slightly modified in VFP.

I don't know all the ins and outs but sometimes you have to set a variable equal to something or use brackets or .something. --Dave
 
Hi my friend
In most cases, the best way to find out how to code an automation task is to record a Macro in this application (Word, Excel, etc..) and then open this macro in VBA editor then translate the code to Visual Fox syntax which is not straight forward task. Read thread184-53564 for some information about the conversion between VB and VFB.

Finally, while you are in VBA editor [Make sure you installed the VBA help files from your Microsoft Office setup disk] you can double click any method or object.

Hope this will help. Walid Magd
Engwam@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top