Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fill out Word Doc from VFP5.0a
Message
 
To
13/12/1997 20:27:02
Carol Adler
U.S. Army Kwajalein
Apo, Marshall Islands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00065785
Message ID:
00065790
Views:
29
>Office '95 (Word Basic)
>
>I got a server error, so don't think this message got out. If so, sorry for doing it again!
>
>When I complete a travel order I want to print it to a Word document. I tried to make it a protected document, with form fields but couldn't make it work. Tried opening as a template but again failure. Then I tried inserting bookmarks and the following code:
>
>PUBLIC oWordObj
>
>USE TRAVEL_ORDERS
>
>oWordObj=CREATEOBJECT("Word.Basic")
>oWordObj.FileOpen("C:\TRAVEL\DOCS\Travform.doc")
>oWordObj.EditGoto("empname")
>oWordObj.Insert(RTRIM(Travel_Orders.Last_name) + ", " + RTRIM(Travel_Orders.First_name) + " " + Travel_Orders.MI)
>oWordObj.EditGoto("empssn")
>oWordObj.Insert(Travel_Orders.ssn)
>oWordObj.EditGoto("emptitle")
>oWordObj.Insert(Travel_Orders.job_title)
>oWordObj.FilePrint
>
>This worked great, but the insertions are cumulative. The first time I ran this .prg the name was inserted. The second time, the name remained from the first run and added the second name into the bookmark. Tried to find a "Replace" command but it wasn't there.
>
>I don't want a print merge, because as a travel order is complete, I want to print just that one (current record) - preferably with a printer prompt, and perhaps allowing saving the document, then return to VFP.
>
>Has someone out there already done this and can help? Thanks

Carol, I hope you'll get answers about printing the Word doc the way you want, but you CAN do a mail-merge quickly by copying the single record to a temp file and using this file for the mail-merge.

I've used this and it works very well.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform