ShellExecute
'Module code - modShellExecute
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
'vbHide = 0
'vbNormalFocus = 1
'vbMinimizedFocus = 2
'vbMaximizedFocus = 3
'vbNormalNoFocus = 4
'vbMinimizedNoFocus = 6
Public Enum vbWindowsState
Hide = 0
NormalFocus = 1
MinimizedFocus = 2
MaximizedFocus = 3
NormalNoFocus = 4
MinimizedNoFocus = 6
End Enum
Public Function OpenApplication(ByVal strOperation As String, _
ByVal strApplicationName As String, _
ByVal strParameter As String, _
ByVal strApplicationDirectory As String, _
ByVal WindowsState As vbWindowsState) As Boolean
Dim nWindowsState As Integer
Select Case WindowsState
Case 0
nWindowsState = vbHide
Case 1
nWindowsState = vbNormalFocus
Case 2
nWindowsState = vbMinimizedFocus
Case 3
nWindowsState = vbMaximizedFocus
Case 4
nWindowsState = vbNormalNoFocus
Case 6
nWindowsState = vbMinimizedNoFocus
End Select
ShellExecute 0&, strOperation, strApplicationName, strParameter, strApplicationDirectory, WindowsState
End Function
'Form code - frmShellExecute
Private Sub cmdShellExecute_Click()
modShellExecute.OpenApplication vbNullString, "The Application", vbNullString, vbNullString, MaximizedFocus
End Sub
From: https://bytes.com/topic/visual-basic/insights/641551-execute-shell-command-program