Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open a PDF file from the VB code 1

Status
Not open for further replies.

amarti44

Programmer
Feb 16, 2001
23
0
0
US
Hi:

I need to open a PDF file from my help menu. I tried the Shell function like this:
RetVal = Shell(App.path + "\filename.pdf", 1)
but it's giving me an "Invalid procedure call" error
Any sugestion...??

Thanks in Advance,

Alberto
 
I have a form with a button that shows a .pdf report if it exists at the top of the form, in the declarations I have this code:

Private 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

This function is what I use to open my pdf files. It works just as well if the report is a text, word, rtf or even a jpg.

Public SubShowReport(ByVal ReportName as String)
ShellExecute hwnd, "open", ReportName, "", App.Path, _ SW_RESTORE
End Sub

scarfhead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top