General information
Category:
Coding, syntax & commands
Title:
Fill out Word Doc from VFP5.0a
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only