- 帖子
- 2035
- 主題
- 24
- 精華
- 0
- 積分
- 2031
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 100
- 性別
- 男
- 註冊時間
- 2012-3-22
- 最後登錄
- 2024-2-1
|
6#
發表於 2013-8-28 14:31
| 只看該作者
本帖最後由 c_c_lai 於 2013-8-28 14:33 編輯
回復 5# linderlong
你試著用 Shell command 的方式執行看看:- Sub Test()
- Dim strIP As String, sp As Variant, RetVal
- Dim cts As Integer, xi As Integer
-
- strIP = "100.18.22.1,100.18.22.2,100.18.22.3,100.18.22.4,100.18.22.5,100.18.22.6,100.18.22.7,100.18.22.8,100.18.22.9,100.18.22.10"
-
- sp = Split(strIP, ",")
- cts = 0
- For xi = 0 To UBound(sp)
- cts = cts + 1
- ' RetVal = Shell("command.com /c Ping -n 1 100.18.22.1 > D:\iptest\1.txt")
- RetVal = Shell("command.com /c Ping -n 1 " & sp(xi) & " > " & ThisWorkbook.Path & "\iptest" & cts & ".txt")
- 工作表1.Cells(cts, 1) = sp(xi)
- Next xi
- End Sub
複製代碼 |
|