问题描述
我正在尝试在文件夹中保存的 PDF 中包含文档标题。这个 vba excel 文件将被放置在与 PDF 相同的文件夹中。下面的代码打开每个 PDF 添加 Title ,保存,关闭 PDF。但是,该代码还将第一个 PDF 的内容保存在剩余的 PDF 中。我不希望每个 PDF 的内容发生变化。我只想在每个 PDF 中包含标题。请让我知道缺少什么。
Sub Add_title()
Dim phApp As FoxitPhantomPDF.FoxitApp
Dim Part1Document As FoxitPhantomPDF.FoxitAVDoc
Dim PDDoc As FoxitPhantomPDF.FoxitPDDoc
Dim FilePath As String
Dim n As Integer
Set phApp = CreateObject("FoxitExch.App")
Set Part1Document = CreateObject("FoxitExch.AVDoc")
FilePath = Dir(ThisWorkbook.Path & "\*.pdf")
n = 0
Dim Response As VbMsgBoxResult
Response = MsgBox("Do you want to process all the files in the folder?",vbQuestion + vbYesNo)
If Response = vbNo Then Exit Sub
Do While Len(FilePath) > 0
Call Part1Document.Open(ThisWorkbook.Path & "\" & FilePath,"")
Part1Document.GetPDDoc.SetInfo "Title","TEST" 'Update title here
Part1Document.GetPDDoc.Save PDSaveFull,ThisWorkbook.Path & "\" & FilePath
Part1Document.GetPDDoc.Close
FilePath = Dir
n = n + 1
Loop
'Part1Document.Close (False)
phApp.Exit
MsgBox (n & " files have been processed.")
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)