Open PDF file


Posted by Jason K on October 05, 2000 12:53 PM

Workbooks.Open ActiveWorkbook.Path + "\" + "EPA.xlt"

The above macro opens the specific file in the current path.
How do I open a .pdf file?

Posted by Ivan Moala on October 06, 2000 2:37 AM

I'm assuming you want to open the pdf file via
]its application (cannot open it anyway into excel)

the following code will work using shellexercute
API

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()
Dim PdfFile As String
Dim FDir As String

PdfFile = "ooslist.pdf" 'Pdf file name
FDir = "D:\HS" 'Directory where Pdf file exists

ShellExecute 0, "Open", PdfFile, "", FDir, 1
End Sub

HTH

Ivan



Posted by Patrick Taylor on November 15, 2000 12:57 PM

OK, code works, (need to declare private functions)BUT....
this works the same as linking to external file. Is there a way
to put the PDF in your spreadsheet and open from there.
Basically, I want to send one spreadsheet to where ever
and have them open PDF from their computer, not send PDF
and spreadsheet. If that was the case, then the coding
is worse than sending the PDF.