* The goal here is to create a .DOC from a .TXT output and * yet retain the .TXT on the server to be archived (we don't * want to literally convert the original file). * Convert .TXT to .DOC format LPARAMETERS lcTxtFile IF !FILE(lcTxtFile) && open text file RETURN ENDIF #DEFINE wdAutoInchesToPoints 72 #DEFINE wdAllowOnlyReading 3 #DEFINE wdFormatDocument 0 LOCAL oWord AS "word.application" oWord = CREATEOBJECT('Word.Application') lcFileDoc = FORCEEXT(lcTxtFile, 'doc') &&LEFT(lcTxtFile,ATC('.txt',lcTxtFile)-1)+'.doc' IF FILE(lcFileDoc) ERASE (lcFileDoc) ENDIF WITH oWord .WordBasic.FileOpen(lcTxtFile) .SELECTION.TypeParagraph .ActiveDocument.SELECT WITH .SELECTION .RANGE.ListFormat.RemoveNumbers .FONT.NAME = "Courier New" .FONT.SIZE = 8 ENDWITH WITH .ActiveDocument .PageSetup.LineNumbering.ACTIVE = .F. .PageSetup.ORIENTATION = 1 .PageSetup.BottomMargin = .3 * wdAutoInchesToPoints .PageSetup.TopMargin = .25 * wdAutoInchesToPoints .PageSetup.LeftMargin = 1.0 * wdAutoInchesToPoints .PageSetup.RightMargin = 1.0 * wdAutoInchesToPoints .PASSWORD="test" && save document into the doc file in the Word format with password .PROTECT(1) .RemovePersonalInformation = .F. .SAVEAS(lcFileDoc, wdFormatDocument) ENDWITH .WordBasic.FileClose() .QUIT ENDWITHJust dinkering with it, really . . .