Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to print Word DOC from VFP
Message
De
03/10/2000 17:31:54
 
 
À
03/10/2000 11:38:06
Jacci Adams
Lindsay-Adams Consulting
Louisville, Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00424046
Message ID:
00424424
Vues:
20
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.
Real office automation starts with hiring a programmer!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform