execute system command VBA excel code example
Example: vba run command
' For VBA / VB / Visual Basic only
'EXAMPLE
sCommandToRun = "copy ""InitialName.xls"" ""NewName.txt"" "
'NOTE: The "" above is the equivalent of " in the command prompt
Call Shell("cmd.exe /S /C" & sCommandToRun, vbHide)
'SYNTAX
' <your-variable-name> = "<MSDos-command-you-want-to-run>"
' Call Shell("cmd.exe /S /C" & <your-variable-name>, vbHide)