Open pdf file using command buttong in excel

Solved/Closed
smd - May 20, 2009 at 04:01 AM
 IAN - Feb 14, 2012 at 05:14 AM
Hello,
i have a form in excel which retrieves details of a user from one of the worksheet. against tht user row, there is a pdf file name which basically is a pdf file sitting on a location on the network. I need to open the pdf file using a command button. below is the code used..but m getting an error "there is an error opening this document file cannot be found"



Path = ActiveSheet.Cells(9, 2) 'this is the main path where all pdf files will b stored which is on a network
'if the path is Z:\SMD Filing System\SMD\
fname = "scan0001.pdf"


retval = Shell("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe path&fname", 1)
Related:

2 responses

remember seeing ur post on another site..and tried that but doesnt work.

i now got it working as below

ActiveWorkbook.FollowHyperlink fpath & attach_name, NewWindow:=True
3
thanks. I works. :)
0
Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 307
May 20, 2009 at 07:36 AM
Hi

Try this (not checked)

retval = Shell("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe " & path & fname, 1)

Do let me know If it helps...
0