【问题标题】:Print to Adobe PDF fails from Word VBA从 Word VBA 打印到 Adob​​e PDF 失败
【发布时间】:2012-09-06 03:19:02
【问题描述】:

与这个问题斗争了一段时间。 Office 2007 和 Adob​​e Pro 10。

让 VBA 代码逐步浏览目录树并将 .doc 和 .docx 文件打印到 PDF 打印机(设置为默认值)。

代码运行良好,但当我尝试打开文件时,Adobe 表示无法打开,因为它不是受支持的文件类型或已损坏。但是,Adobe 是通过 Adob​​e PDF 打印机创建的。

如果我从 Word 中手动打印,它工作得很好,所以我猜它是 vba 中的东西。所有参数都很好——我能说的最好,而且我已经设置了正确的默认值/首选项。请注意,在下面的代码中,我什至尝试使用 Application.Printout 并得到了相同的结果。

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 是输出的完全限定文件名。它工作正常,因为我可以在我期望的位置找到文件。

【问题讨论】:

    标签: pdf printing adobe


    【解决方案1】:

    据我所知,PrintToFile:= True 强制格式为 PS(后记)而不是 PDF。因此,您需要将文件从 PS 转换为 PDF(可以自动化)。以this link 为例。

    【讨论】:

      猜你喜欢
      • 2018-12-06
      • 2011-05-14
      • 1970-01-01
      • 2013-04-08
      • 2011-04-05
      • 2014-03-10
      • 2020-05-26
      • 1970-01-01
      • 2019-06-21
      相关资源
      最近更新 更多