Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing a Word Document
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00443225
Message ID:
00443334
Views:
9
>I've spent my entire xBase life without ever having to interact with any of the other inhabitants of my computer. I now find a need to take a Word document and sent it to the printer.
>
>I'd appreciate any help which can get me started.
>
>Thanks to all
>
>.........Rich

Below is some sample code for opening and then printing a Word document from VFP. I assume it would be wise to implement some error trapping to make sure Word exists, etc, but the basics of opening and printing the document are outlined below. (Please note that this samplec code never "shows" Word.)

oWord=CREATE('Word.Application')
oWord.Documents.OPEN("C:\DOCFOLDER\DOCNAME.DOC")
oWord.ActiveDocument.PrintOut(0)
oWord.ActiveDocument.CLOSE(0)
oWord.QUIT(0)
RELEASE oWord

As the others have recommended, I would also highly recommend Tamar Granor's book "Microsoft Office Automation with Visual FoxPro" published by Hentzenwerke Publishing.

HTH,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform