from http://www.vbcity.com/forums/faq.asp?fid=9&cat=Shell
Public 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
ShellExecute hwnd, "open", "C:\Netlog.txt", vbNullString, "C:\", 1
' Obviously, the file must exist at that location for this to work.
ShellExecute hwnd, "open", "C:\windows\script.doc", vbNullString, "C:\", 3
' (You can type the above all on one line of code - minus the underscore)
ShellExecute hwnd, "open", "C:\acrobat3\reader\acrobat.pdf", vbNullString, "C:\", 1
' (You can type the above all on one line of code - minus the underscore)
Shell ("c:\windows\calc.exe")
Shell ("c:\iridium.exe") '
* Obviously, assuming you have such a file on your C Drive.
Shell ("c:\RunMe.com")
'* As above
Shell ("c:\windows\help\pingnum.bat")
Dim RetVal as Double
' To run a file in Normal WindowState, use 1 or vbNormalFocus
RetVal = Shell("c:\windows\notepad.exe", 1)
'or
RetVal = Shell("c:\MyApp.exe", vbNormalFocus)
' To open minimized, use 6 or vbMinimizedFocus
RetVal = Shell("c:\windows\help\pingnum.bat", vbMinimizedFocus)
' And, for Maximized, use 3 or vbMaximizedFocus
RetVal = Shell("C:\Windows\PBrush.exe", 3)
|