'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' 外部プログラム実行
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Public Function F_Shell_Run( _
ByVal aCmd As String, _
Optional ByVal aWindowStyle As Long = 0, _
Optional ByVal aWaitOnReturn As Boolean = False) As Boolean
Dim wkRet As Boolean: wkRet = False
Dim wkRtn As String
Dim wkShell As New WshShell
Dim wkCmdRet As Integer
'引数チェック
If aCmd = "" Then
Exit Function
End If
On Error GoTo PROC_ERROR
'コマンド実行
wkCmdRet = wkShell.Run(aCmd, WindowStyle:=aWindowStyle, WaitOnReturn:=aWaitOnReturn)
If aWaitOnReturn = True Then
'正常終了している場合は正常を返却
If wkCmdRet = 0 Then
wkRet = True
End If
Else
'一旦正常とする
wkRet = True
End If
On Error GoTo 0
PROC_ERROR:
F_Shell_Run = wkRet
End Function
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme