View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eugene[_7_] Eugene[_7_] is offline
external usenet poster
 
Posts: 2
Default Opening PDFs from VBA??

Hi All,

I am write a simple macro to open a PDF from VBA, but I want the name
of the PDF and location of the PDF as a string value, such that one
could assign the macro to a button in excel and use it when needed.

So far I have:

Sub pdfVBA()
Dim pdfLoc, pdfName As String

'change this to location of directory
pdfLoc = "M:\"

pdfName = ActiveCell.Value

Shell "C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe" & _
pdfLoc & pdfName, 1

End Sub

But I am receiving an "File not found" error. I suspect I has
something to do with using the string values, because when I replace
pdfLoc and pdfName with the location and file the code works.

Thanks for any help in advance
Eugene