Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to print Word DOC from VFP
Message
From
03/10/2000 21:57:29
Jacci Adams
Lindsay-Adams Consulting
Louisville, Ohio, United States
 
 
To
03/10/2000 17:31:54
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00424046
Message ID:
00424503
Views:
20
Hi Denny,

Glad I could be of assistance.

>If you have time will you please tell me how to bypass the
>print dialogue window? It waits for Ok or Cancel button to
>be pressed.

I've not had to do this. There is a PrintOut method of the Document object that automates printing that you might want to take a look at. It has 19 parameters to it. I have no idea if this is the correct method or not. I just took a quick peek at the Granor/Martin book and this is what I found on printing Word documents.

If you are needing to do lots of automation the Granor/Martin book is worth every penny. It has saved me hours of aggravation. (I had nothing to do with the books creation or promotion, I just think it is a must have for all VFP developers.)

Jacci

>Hi Jacci:
>
>Thank you very much for your timely help - especially about
>creating a macro and stealing the code. That was a
>neat little trick! and I didn't know - until now. Thank you
>once again.
>
>Below is the VFP code I put together. I exececute it by calling
>the function like:
>
>do part with "b:\part.doc",2 ,2
>
>If you have time will you please tell me how to bypass the
>print dialogue window? It waits for Ok or Cancel button to
>be pressed.
>
>* * * *
>proc part
>lparameters cDocName, iRecordFrom, iRecordTo
>Local oWord
>
>m.oWord = CREATEOBJECT("Word.Application")
>
>WITH m.oWORD
> .Documents.Open(m.cDocName)
> With .ActiveDocument.MailMerge
> .Destination = 1 && Printer
> .MailAsAttachment = .F.
> .MailAddressFieldName = ""
> .MailSubject = ""
> .SuppressBlankLines = .T.
> With .DataSource
> .FirstRecord = m.iRecordFrom
> .LastRecord = m.iRecordTo
> EndWith
> .Execute
> EndWith
> .Documents.Close(0)
> .Application.Quit
>ENDWITH
>
>* * * *
>
>>Hi Denny,
>>
>>The easiest way to get started with this is to record a macro in Word97 with all of the things you want VFP to automate for you. Then edit the Word97 macro, you will see all of the Objects, methods, and properties for the steps you just created. While in the Word Visual Basic editor there is an object browser button that can help you with the property translations.
>>
>>You will then have to translate this into VFP code.
>>
>>If this is the first time you are doing this, I would highly recommend MS Office Automation with VFP by Granor/Martin. You can get it from www.hentzenwerke.com. I don't believe you can order on-line but you can call them order and pay for it and download the .CHM of the book.
>>
>>HTH,
>>Jacci
>>
>>
>>>I am in lookout for a way to print a word97 mailmerged document that uses data from a VFP table.
>>>
>>>I am a VFP programmer and to those of you who have done some research and homework in the direction that I could use your tip. Here is what I am looking to do:
>>>
>>>1. from VFP start WORD 97: say m.oWORD = create("word.application")..?
>>>
>>>2, load a DOC file which has mailmerge info
>>>(I presume this would automatically open the referenced DBF table)
>>>
>>>3. print page number say 5 to 9
>>> (I intend the document to merge records 5 through 9 and print a page for each)
>>>
>>>4. close the word instance so that next session would not crash.
>>>
>>>Thanks in advance.
Previous
Reply
Map
View

Click here to load this message in the networking platform