很简单的一段代码啊,用VBSEDIT运行未提示错误,保存成VBS执行后就提示当面页面的脚本发生错误
行:1 char:1 错误:意外地调用了方法或属性访问。 代码:0
以下是代码原文,虽然提示出错,但还是执行完了,搞不明白什么情况:- Dim app,wb,arr,sh
- Set app = GetObject(,"excel.application")
- Set wb = app.activeworkbook
- Set sh = wb.activesheet
- Set rng = app.selection
- app.ScreenUpdating = False
- arr = rng
- For i = 1 To UBound(arr)
- arr(i,1) = rng(i,1).text
- next
- For i = 1 To UBound(arr)
- wb.worksheets.add(,wb.activesheet).name = arr(i,1)
- Next
- sh.activate
- app.ScreenUpdating = True
-
- Dim wsh
- Set wsh = CreateObject("WScript.Shell")
- wsh.Run "mshta vbscript:ClipboardData.SetData("&chr(34)&"已执行完毕"&chr(34)&"," &Chr(34)& Text &Chr(34)& ")(close)",0,True
- set wsh=Nothing
复制代码
|