微软宏,如何使用shell()?
microsoft macros, how to use shell()?
我在 Microsoft Word 2007 中将以下代码作为宏:
Sub AutoExec()
MsgBox "hello"
Dim RetVal
Set RetVal = Shell("wscript.exe C:\Docs\test.vbs", 1)
End Sub
但是我在单词 'Shell' 上遇到编译错误(错误是 'Object required')。我该如何解决这个问题,因为我看到的所有地方都给出了相同的语法。
Shell returns ID,不是对象。所以改变
Set RetVal = Shell("wscript.exe C:\Docs\test.vbs", 1)
至
RetVal = Shell("wscript.exe C:\Docs\test.vbs", 1)
我在 Microsoft Word 2007 中将以下代码作为宏:
Sub AutoExec()
MsgBox "hello"
Dim RetVal
Set RetVal = Shell("wscript.exe C:\Docs\test.vbs", 1)
End Sub
但是我在单词 'Shell' 上遇到编译错误(错误是 'Object required')。我该如何解决这个问题,因为我看到的所有地方都给出了相同的语法。
Shell returns ID,不是对象。所以改变
Set RetVal = Shell("wscript.exe C:\Docs\test.vbs", 1)
至
RetVal = Shell("wscript.exe C:\Docs\test.vbs", 1)