Public Sub Dosコマンド実行()
    Dim WSH, wExec, sCmd As String, Result As String
    Set WSH = CreateObject("WScript.Shell")         ''(1)
    sCmd = ActiveCell.Value                         ''(2)
    Set wExec = WSH.Exec("%ComSpec% /c " & sCmd)    ''(3)
    Do While wExec.Status = 0                       ''(4)
        DoEvents
    Loop
    ClipBoadCopy wExec.StdOut.ReadAll                    ''(5)
    Set wExec = Nothing
    Set WSH = Nothing
End Sub