VBScript脚本运行后,提示“远程服务器不存在或不可用:'CreateObject'”
这个问题其实有点白痴,我运行的是VBScript用户手册中“CreateObject函数”一段的代码,但是运行后却报错了(错误如题,错误代码是800A01CE)请哪位高手...
这个问题其实有点白痴,我运行的是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 展开
请哪位高手为我指点下,到底是哪里设置不对了呢?我在本机运行的,按说没错呀
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 展开
1个回答
展开全部
我电脑没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"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询