infile="myWord.doc" if file(infile)=.f. missingfile=messagebox("File no longer exists or was moved. Do you want to look for it?","Missing Input File",4) if missingfile=6 infile=getfile() else return endif endif m.ext=upper(justext(infile)) do case case m.ext=="DOC" typeoffile="WORD" otherwise messagebox("Only File Extensions of 'DOC' are currently supported","File Error",0) return endcase if not directory("pdffiles") mkdir pdffiles endif psfile=sys(5)+sys(2003)+"\Output.PDF" printertouse="PDF995" lcdefaultprinter = set("PRINTER",3) strtofile(lcdefaultprinter,"oldprinter.txt") pmissing="N" on error pmissing="Y" onet = createobject("WScript.Network") onet.setdefaultprinter(printertouse) if m.pmissing="Y" messagebox("Please Add Printer '"+printertouse+"' as a Print-to-File Printer"+chr(13)+; "using 'printers/faxes->add printer wizard' in the control pannel.","PS Printer Not Found",0) return endif on error do oldprinter loword = createobject("Word.Application") with loword .displayalerts = .f. .visible=.f. .documents.open(infile) .activedocument.printout(0,0,0,PSFile) .quit endwith loword=.null. onet.setdefaultprinter(lcdefaultprinter) procedure oldprinter lcdefaultprinter = filetostr("oldprinter.txt") onet = createobject("WScript.Network") onet.setdefaultprinter(lcdefaultprinter) messagebox("Error! Please Check Printer Driver and MS Office Availability."+chr(13)+; "printer returned to default.","Conversion to PS Error",0) on error endprocnoticed the line
.activedocument.printout(0,0,0,PSFile), i used this to programmatically name the pdf file.