Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create Word file from general field

Status
Not open for further replies.

gattabria

Programmer
Jul 17, 2004
26
US
I have a general field with a one page Microsoft Word document. I need to create a Word.doc file from each record that contains the Word document and name the Word document the same as a text field in the same record.
 
This should do it. Tested ok on my machine with 2 sample docs. You may need to adjust the lenght of the header based on your VFP/Word versions. I used 610 here.

Brian

Code:
USE MyTable

SCAN
	lcOutputNameAndPath=SYS(5)+SYS(2003)+[\]+MyFileName &&Or where you want
	COPY TO MyTempFile NEXT 1
	lcFile=FILETOSTR("MyTempFile.FPT")
	STRTOFILE(RIGHT(lcFile,LEN(lcFile)-610),lcOutputNameAndPath)
ENDSCAN

DROP TABLE MyTempFile
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top