在MS Outlook中使用PDFMaker [英] Use PDFMaker with MS Outlook

查看:100
本文介绍了在MS Outlook中使用PDFMaker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Adobe PDFMaker加载项与MS Outlook 2013配合使用.

i want to use the Adobe PDFMaker add-in with MS Outlook 2013.

使用PDFMAKER将多封电子邮件保存为pdf

我看过这篇文章并尝试了代码,但是我在行中遇到了运行时错误13(类型不匹配)

I've seen this post and tried the code, but i get an runtime-error 13 (type mismatch) at the line

Set pmkr2 = a.Object

似乎来自a.Object的对象不是PDFMaker对象. 看到这张图片 我正在使用Adobe Acrobat DC 18.2816. 这是我的整个代码:

It seems like the object coming from a.Object is not an PDFMaker object. See this picture I am using Adobe Acrobat DC 18.2816. Here is my whole code:

    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

如果有人能够帮助我,这将非常好,谢谢您!

It would be very nice if someone would be able to help me, thank you in advance!

推荐答案

在声明中尽量不要太具体.

Try being less specific in the declaration.

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

这篇关于在MS Outlook中使用PDFMaker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆