Reputation: 33
Been fighting with this for a while. Office 2007 and Adobe Pro 10.
Have VBA code to step through a directory tree and print .doc and .docx files to PDF Printer (set as default).
Code runs fine but when I try to open the file, Adobe says it can't because it's not a supported file type or is damaged. But, Adobe is the one that created it via the Adobe PDF printer.
If I manually print from within Word, it works just fine so I'm guessing it's something in the vba. All the parameters are fine - best I can tell, and I've sett the proper defaults/preferences. Note in the code below I even tried using the Application.Printout and got the same results.
Documents.Open FileName:="""" & FolderPath & "\" & sDocName & """", ReadOnly:=True ' Application.PrintOut FileName:="""" & FolderPath & "\" & sDocName & """", OutputFileName:=PDFDoc, _ PrintToFile:=True, Background:=True ActiveDocument.PrintOut OutputFileName:=PDFDoc, Background:=True Documents(sDocName).Close savechanges:=False
PDFDoc is the fully qualified file name for the output. It's working fine as I can find the file where I expect it to be.
Upvotes: 2
Views: 1594