Open pdf file using command buttong in excel [Solved/Closed]

smd - May 20, 2009 at 04:01 AM - Latest reply:  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)
See more 

3 replies

Best answer
3
Thank you
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

Thank you, smd 3

Something to say? Add comment

CCM has helped 1704 users this month

thanks. I works. :)
Excelguru 261 Posts Saturday April 11, 2009Registration date June 21, 2011 Last seen - May 20, 2009 at 07:36 AM
0
Thank you
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...