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

Shell question!

Status
Not open for further replies.

Paco75

Programmer
Oct 11, 2001
239
US
Hi, is there a way to launch an external application without having to tell the entire path?

ex:
test = Shell("Acrobat.exe c:\test.pdf", vbMinimizedFocus)

I tried this last one but It do not work! Since Acrobat can be installed anywhere on the PC I can't bet on a fixed path... and searching the entire drives is too long. What I want is to let windows detect the needed application...

thanks a lot
 
Try this:
Code:
Option Explicit
Public Declare Sub 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)
Sub test()
Dim hWnd As Long
  ShellExecute hWnd, "Open", "c:\test.pdf", "", "", vbNormalFocus
End Sub
 

Check out MS and search for ShellExecute or ShellExecuteEx API functions.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top