How to embed a PDF file into a userform



Hi there

I saw a post the other day with someone asking how to show or embed an
acrobat file in a userform. I can't remember who it was that posted
but I thought I would put this up just in case they are on line having
a look. This works with Excel 2000 SP3 and Acrobat reader 6 I can't
tell you if it will work with any other versions as I don't have them
to test.

In the VBE>Tools Menu>References check the checkbox for "Acrobat
control for ActiveX".

Then on your toolbox right click and select addition controls and again
check the "Acrobat control for ActiveX" checkbox.

This will add an adobe acrobat control to your toolbox.

Drag a PDF control on to a user form and then add the following code

Option Explicit
Private Sub UserForm_Initialize()
Pdf1.LoadFile ("C:\Test\excel vba.pdf")
' you can use this to turn the toolbars on and off
Pdf1.setShowToolbar False
End Sub
' when you unload the form you need to close the PDF before doing so
or acrobat will
' give you an error. I'm not sure if this is the best way but it
worked for me.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Pdf1.LoadFile ("")
End Sub

Hope this is of some help.




Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question