View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
damorrison damorrison is offline
external usenet poster
 
Posts: 91
Default Open pdf file selected from excel

On Sep 23, 6:40*am, Daniel Pineault
wrote:
Use the FollowHyperlink Method (see the example in the help file). *it will
open any file in the default program associated with it.
--
Hope this helps,

Daniel Pineaulthttp://www.cardaconsultants.com/
For Access Tips and Examples:http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.

"damorrison" wrote:
I am using a code to select a folder, and then show the pdf files
Sub SelectPdfFile()
* * Dim fn As Variant
* * Dim i As String
* * i = InputBox("Enter Job Number", , "Job Number")


* * P = "C:\" & i & "\"
* * ChDrive P
* * ChDir P


* * fn = Application.GetOpenFilename("PDF Files,*.pdf", _
* * * * * * * * * * * * * * * * * * *1, "Select Truss Picture", ,
False)
* * If TypeName(fn) = "Boolean" Then Exit Sub * *' no selection
* * Debug.Print "Selected file: " & fn
* * Workbooks.Open fn
End Sub
.............
Is there a way to open the selected pdf file from this location with
acrobat?
Or would it be better to insert the pdf as an object
something like this
------------
Sub SelectPdfFile()
* * Dim fn As Variant
* * Dim i As String
* * Dim p As String
* * i = InputBox("Enter Job Number", , "Job Number")


* * p = "C:\" & i & "\"
* * ChDrive p
* * ChDir p


* * fn = Application.GetOpenFilename("PDF Files,*.pdf", _
* * * * * * * * * * * * * * * * * * *1, "Select Truss Picture", ,
False)
* * If TypeName(fn) = "Boolean" Then Exit Sub * *' no selection
* * Debug.Print "Selected file: " & fn
* * ActiveSheet.OLEObjects.Add(Filename:=p & fn & ".pdf", _
* * * * Link:=False, DisplayAsIcon:=False).Select
End Sub
---------------------
Though I still can't get it to work,


Thanks, it works