这个问题其实有点白痴,我运行的是VBScript用户手册中“CreateObject 函数”一段的代码,但是运行后却报错了(错误如题,错误代码是800A01CE)
请哪位高手为我指点下,到底是哪里设置不对了呢?我在本机运行的,按说没错呀
Dim ExcelSheet
Set ExcelSheet = CreateObject("Excel.Sheet","My Server")
' Make Excel visible through the Application object.
ExcelSheet.Application.Visible = True
' Place some text in the first cell of the sheet.
ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1"
' Save the sheet.
ExcelSheet.SaveAs "C:\DOCS\TEST.XLS"
' Close Excel with the Quit method on the Application object.
ExcelSheet.Application.Quit
' Release the object variable.
Set ExcelSheet = Nothing
VBScript脚本运行后,提示“远程服务器不存在或不可用:'CreateObject'”
答案:1 悬赏:20 手机版
解决时间 2021-02-18 16:39
- 提问者网友:练爱
- 2021-02-17 22:15
最佳答案
- 五星知识达人网友:独行浪子会拥风
- 2021-02-17 23:54
我电脑没excel没法测试
Set ExcelSheet = CreateObject("Excel.Sheet","My Server")
看了一下,应该是
Set ExcelSheet = CreateObject("Excel.application")
我以前做的关于excel的一些脚本
希望对你有帮助
'InXlsFile = CreateObject("Excel.Application").GetOpenFilename("Excel Files (*.xls), *.xls")
set args = wscript.arguments
if args.count <> 1 then wscript.quit
arg = args(0)
'msgbox arg
set e = CreateObject("Excel.Application")
e.visible = true
'****************************打开指定文件,并读取指定单元内容*********************************
'Set ew = e.Workbooks.Open(arg)
'set es = ew.Worksheets(1)
'on error resume next
'for i = 1 to 10
' for j = 1 to 10
' msgbox(es.cells(i,j))
' next
'next
'**********************************************************************************
set nb = e.workbooks.add
set ns = nb.worksheets(1)
'ns.cells(1,1) = now
'ns.saveas "c:\excel.xls"
'*******************************************************************************
'for i = 1 to 7
'ns.cells(1,i) = "星期"&i
'next
'ns.saveas "c:\e.xls"
'e.quit
'***********************************************************************
for i = 1 to 200
for j = 97 to 122
k = chr(j)
ns.range(k&i).value = "第"&i&"个"
next:next
ns.saveas "c:\xx.xls"
Set ExcelSheet = CreateObject("Excel.Sheet","My Server")
看了一下,应该是
Set ExcelSheet = CreateObject("Excel.application")
我以前做的关于excel的一些脚本
希望对你有帮助
'InXlsFile = CreateObject("Excel.Application").GetOpenFilename("Excel Files (*.xls), *.xls")
set args = wscript.arguments
if args.count <> 1 then wscript.quit
arg = args(0)
'msgbox arg
set e = CreateObject("Excel.Application")
e.visible = true
'****************************打开指定文件,并读取指定单元内容*********************************
'Set ew = e.Workbooks.Open(arg)
'set es = ew.Worksheets(1)
'on error resume next
'for i = 1 to 10
' for j = 1 to 10
' msgbox(es.cells(i,j))
' next
'next
'**********************************************************************************
set nb = e.workbooks.add
set ns = nb.worksheets(1)
'ns.cells(1,1) = now
'ns.saveas "c:\excel.xls"
'*******************************************************************************
'for i = 1 to 7
'ns.cells(1,i) = "星期"&i
'next
'ns.saveas "c:\e.xls"
'e.quit
'***********************************************************************
for i = 1 to 200
for j = 97 to 122
k = chr(j)
ns.range(k&i).value = "第"&i&"个"
next:next
ns.saveas "c:\xx.xls"
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯