Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 91
Default Open pdf file selected from excel

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,
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default Open pdf file selected from excel

' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.

Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator

--
Rui


"damorrison" wrote in message
...
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,



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 91
Default Open pdf file selected from excel

On Sep 23, 6:33*am, "ruic" wrote:
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.

Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator

--
Rui

Very interesting,
Acrobat opens but the selected file does not, here is the new code:
Sub SelectPdfFile()
Dim fn As Variant
Dim i As String
Dim p As String
Dim RetVal
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
RetVal = Shell("C:\Program Files\Adobe\Reader 8.0\Reader
\AcroRd32.exe", 1) & fn
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Open pdf file selected from excel

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 Pineault
http://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,

  #5   Report Post  
Posted to microsoft.public.excel.misc
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel file does not open when selected airnet Excel Discussion (Misc queries) 2 July 21st 08 08:36 PM
Macro To Open a User selected File Chris Excel Worksheet Functions 2 September 6th 07 08:58 PM
Excel 2007 doesn't open files selected using Explorer or Recent Do Kurt Excel Discussion (Misc queries) 0 January 31st 07 07:51 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
EXCEL SELECTED FILE DOES NOT OPEN ONLY BLANK EXCEL MUST GO THROUG. jcjnew Excel Discussion (Misc queries) 1 September 22nd 05 09:10 AM


All times are GMT +1. The time now is 06:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"