vba中的telnet脚本错误

时间:2016-02-10 21:26:38

标签: excel vba excel-vba

所以我在vba中编写脚本来执行telnet,以下是代码的一部分。

Dim vPath As String
Dim vFile As String
Dim vFTPServ As String
Dim ServSlot As String
Dim fNum As Long



 vPath = Application.InputBox("Enter the File Directory")
 vFile = Application.InputBox("Enter the File Name")
 vFTPServ = Application.InputBox("Enter the IP Address")
 ServSlot = Application.InputBox("Enter the slot #")



 Dim WshShell As Object
 Set WshShell = CreateObject("WScript.Shell")
 WshShell.Run "cmd.exe"
 WScript.Sleep 1000

似乎代码工作正常,直到cmd.exe,然后显示运行时错误" 424" - 所需对象。对于Wscript.sleep 1000行。

任何形式的帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

声明像WScript这样的对象的通用方法是

Dim WshShell As Object

set WshShell=CreateObject("WScript.Shell")