Display PDF in Excel VBA UserForm

前端 未结 1 739
感情败类
感情败类 2021-02-09 16:50

I am running Excel 2016, which may be relevant if the below is a compatibility issue...

In short, I am trying to display a PDF, embedded in a UserForm in Excel.<

1条回答
  •  长发绾君心
    2021-02-09 17:11

    As an alternative to using the AcroPDF, try using the WebBrowser Object.

    It requires including the additional control

    Microsoft Web Browser

    Add a WeBrowser on the UserForm named WebBrowser1

    Private Sub UserForm_Click()
        Me.WebBrowser1.Navigate "about:blank"
        Me.WebBrowser1.Document.write ""
    End Sub
    

    You can just .Navigate to the PDF directly, but, to quote my comment:

    "It's safer to use the html part, depending on the machine settings, sometimes direct navigation will initiate download instead of display."

    0 讨论(0)
提交回复
热议问题