Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fill out Word Doc from VFP5.0a
Message
From
13/12/1997 20:27:02
Carol Adler
U.S. Army Kwajalein
Apo, Marshall Islands
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Fill out Word Doc from VFP5.0a
Miscellaneous
Thread ID:
00065785
Message ID:
00065785
Views:
72
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
Next
Reply
Map
View

Click here to load this message in the networking platform