Display PDF in Excel VBA UserForm

佐手、 提交于 2019-12-04 06:58:45
cyboashu

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 "<HTML><Body><embed src=""C:\temp\SO_Answers\test.pdf"" width=""100%"" height=""100%"" /></Body></HTML>"
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."

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!