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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute Open a pdf files

Status
Not open for further replies.

nhidalgo

MIS
Jun 13, 2001
619
US
I am using shellexecute to open a pdf file. I get the acrobat splach screen, but acrobat never becomes visible. It is running if i check task manager though. Also if i then just type "acrobat" from the start/run menu it pops up with the file i reference. Here is the code i'm using. Not sure what the problem is. I get a return value of 42.
Thanks
Nick

Private Declare Function ShellExecute Lib "shell32" 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

Private Sub cmdview_Click()
Screen.MousePointer = vbHourglass

f$ = Dir("\\storetermserv\invoices\*_" & Val(txtinvoice.Text) & "_*.pdf")
If f$ = "" Then MsgBox "Invoice # " & Val(txtinvoice.Text) & " was not found", vbOKOnly, "View Invoices": Screen.MousePointer = vbNormal: Exit Sub
retval = ShellExecute(0&, "Open", f$, "", "\\storetermserv\invoices\", SW_SHOWMAXIMIZED)
Screen.MousePointer = vbNormal

End Sub

 
Found the problem

Added

Const SW_SHOWNORMAL = 1

and now everything works.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top