0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

外部プログラム実行

Posted at
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' 外部プログラム実行
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?