我想将 Adobe PDFMaker 插件与 MS Outlook 2013 一起使用。
使用 PDFMAKER 将多封电子邮件保存为 pdf https://stackoverflow.com/questions/44723984/saving-multiple-e-mails-to-pdf-with-pdfmaker/51400870#51400870
我看过这篇文章并尝试了代码,但我在该行收到运行时错误 13(类型不匹配)
Set pmkr2 = a.Object
来自 a.Object 的对象似乎不是 PDFMaker 对象。看这张图片 https://i.stack.imgur.com/Y5yXw.png我正在使用 Adobe Acrobat DC 18.2816。
这是我的整个代码:
Sub ConvertToPDFWithLinks()
Dim pmkr2 As AdobePDFMakerForOffice.PDFMaker
'Set pmkr2 = Application.COMAddIns.Item(6).Object ' Assign object reference.
Set pmkr2 = Nothing
For Each a In Application.COMAddIns
If InStr(UCase(a.Description), "PDFMAKER") > 0 Then
Set pmkr2 = a.Object
Exit For
End If
Next
If pmkr2 Is Nothing Then
MsgBox "Cannot Find PDFMaker add-in", vbOKOnly, ""
Exit Sub
End If
Dim pdfname As String
pdfname = "C:\stuff\stuff\tester.pdf"
Dim stng As AdobePDFMakerForOffice.ISettings
pmkr2.GetCurrentConversionSettings stng
stng.AddBookmarks = True
stng.AddLinks = True
stng.AddTags = True
stng.ConvertAllPages = True
stng.CreateFootnoteLinks = True
stng.CreateXrefLinks = True
stng.OutputPDFFileName = pdfname
stng.PromptForPDFFilename = False
stng.ShouldShowProgressDialog = True
stng.ViewPDFFile = False
pmkr2.CreatePDFEx stng, 0
Set pmkr2 = Nothing ' Discontinue association.
End Sub
如果有人能够帮助我,那就太好了,提前谢谢!
尝试在声明中不那么具体。
Sub getAnObject()
Dim pmkr2 As Object
Dim a As Object
Dim srchString As String
srchString = "PDFMAKER"
Set pmkr2 = Nothing
For Each a In Application.COMAddIns
Debug.Print "a.Description: " & a.Description
If InStr(UCase(a.Description), srchString) > 0 Then
If MsgBox("Is this what you want? " & vbCr & vbCr & a.Description, vbYesNo + vbQuestion) = vbYes Then
Set pmkr2 = a
Exit For
End If
End If
Next
If pmkr2 Is Nothing Then
Debug.Print "Cannot find the object using search string " & srchString
Else
Debug.Print "Object found: " & pmkr2.Description
End If
Set pmkr2 = Nothing ' Discontinue association.
End Sub
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)