标题: [问题求助] VBS脚本操作Excel出错提示:意外地调用了方法或属性访问 [打印本页]
作者: 湘喑 时间: 2021-10-20 13:31 标题: VBS脚本操作Excel出错提示:意外地调用了方法或属性访问
很简单的一段代码啊,用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
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |