VBScript脚本运行后,提示“远程服务器不存在或不可用:'CreateObject'”

来源:百度知道 编辑:UC知道 时间:2024/06/04 11:41:31
这个问题其实有点白痴,我运行的是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

我电脑没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