
You can run “command”!
*Command Prompt.

Use “Run method” of “WScript.Shell object“!
VBA Code
For example, run following “command“:
*Create folder001.
mkdir C:\Users\user\Desktop\folder001
You can run “command” by “Run method” of “WScript.Shell object“.
Option Explicit
Sub sampleProc()
Dim command As String
Dim wsh As Object
Dim result As Integer
'Set "command"
command = "mkdir C:\Users\user\Desktop\folder001"
Set wsh = CreateObject("WScript.Shell")
'Run the "command"
'Return
'┗0 : Succeeded
'┗1 : failed
result = wsh.Run("%ComSpec% /c " & command, WindowStyle:=0, WaitOnReturn:=True)
If (result = 0) Then
MsgBox ("Succeeded Run command.")
Else
MsgBox ("failed Run command.")
End If
Set wsh = Nothing
End Sub
Result
You ran “command(Command Prompt)“!
*Created folder001.

