open a PDF with VBA

J

j

I have a resume database with a field called PDF that stores the whole path
for the PDF of each resume. I would like to create a button on a form that
will open Acrobat Reader and the appropriate PDF. I thought this would be
simple enough but I cant seem to find an appropriate function in VBA. Can
someone point me in the right direction?

Thanks
 
N

Norman Yuan

Yes, it is simple enough: simply call Shell() in VBA by passing the full PDF
file name retrieved from the record. You need Adobe Reader installed, of
course.

Shell "C:\myPDFFolder\PDFFile.pdf"
 
D

Dirk Goldgar

j said:
The Shell functions seems to only work on exe files for me.

To use Shell, you'd have to pass both the Reader application's path and
the name of the file to be opened. However, assuming that Acrobat
Reader is registered as the application to open PDF files, you can
probably open the PDF file using Application.FollowHyperlink:

Application.FollowHyperlink "C:\myPDFFolder\PDFFile.pdf"

If that doesnt work, you can call the ShellExecute API, using the
fHandleFile function posted at:

http://www.mvps.org/access/api/api0018.htm
 

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

Top