![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Location: Mexico
Posts: 5
|
I have a searchable data range which points to several PDF files, so I can open them after finding references in Excel.
The question is: Is there a way to open the selected file from within excel via VB? Please help. |
|
|
|
|
|
#2 | |
|
New Member
Join Date: Apr 2002
Location: Mexico
Posts: 5
|
Quote:
Hope it helps to clarify. |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
can i ask why you wish to do this, is the pdf file reference material, if so can this not be put in excel in own sheet so hyperlink can be used or in own WkBk and opened/viewed...
just finding some back ground PS what version of Adobe wre the PDF files constructed in or where the bastardised in to pdf... i ask as you only want to view them, so i ask where did these files come from... yes this does matter.. ill explain.
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#4 |
|
New Member
Join Date: Apr 2002
Location: Mexico
Posts: 5
|
Thanks for your answer.
The PDF files came on technical data cd which doesn't work anymore, so I put them in a folder in HD. I created an index so I can search for reference and excel points to filename to open. At this point I switch to Reader and open file. I'd like to point to reference in Excel and open the Reader's file. |
|
|
|
|
|
#5 | |||||||||||||||||||
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
I'm assuming you mean you have the Full file name listing in the rows ?? eg.
This table was created by a free Excel macro written by Charles BalchHere's the code. It is care ware - it's yours for free if do something nice for anyone. Amended @ http://www.gwds.co.nz/ . This File is currently - being amended for the Boards users by Ivan F Moala. If so then this may help you; Option Explicit Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal Hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Sub Open_Pdf_FromList() Dim sPdfFile As String Dim sFDir As String Dim X '// Get Full PDF FileName from Activecell sPdfFile = ActiveCell.Text If sPdfFile = "" Then GoTo Check1 If Dir(sPdfFile) = "" Then GoTo Check2 '// Get Directory name Only X = Split(sPdfFile, Application.PathSeparator) ReDim Preserve X(0 To UBound(X) - 1) sFDir = Join(X, Application.PathSeparator) & Application.PathSeparator '// Get FileName Only X = Split(sPdfFile, Application.PathSeparator) sPdfFile = X(UBound(X)) '// Now Open PDF File ShellExecute 0, "Open", sPdfFile, "", sFDir, 1 Exit Sub Check1: MsgBox "Cell is Empty!" Exit Sub Check2: MsgBox sPdfFile & vbCrLf & vbCrLf & "Is not valid or does not exist" End Sub Just select the cell reference and run this macro..... |
|||||||||||||||||||
|
|
|
|
|
#6 |
|
New Member
Join Date: Apr 2002
Location: Mexico
Posts: 5
|
Thank you very much for kind answer.
It works nice and smooth. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|