'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' 外部プログラム実行結果取得
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Public Function F_Shell_GetResult( _
ByRef aRtn As String, _
ByVal aCmd As String) As Boolean
Dim wkRet As Boolean: wkRet = False
Dim wkRtn As String
Dim wkShell As New WshShell
Dim wkExec As Object
'引数チェック
If aCmd = "" Then
Exit Function
End If
On Error GoTo PROC_ERROR
'コマンド実行
Set wkExec = wkShell.Exec(aCmd)
wkRtn = wkExec.StdOut.ReadAll
On Error GoTo 0
If wkRtn <> "" Then
aRtn = wkRtn
wkRet = True
End If
PROC_ERROR:
F_Shell_GetResult = 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