佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 951|回复: 5

VBscript 的问题

[复制链接]
发表于 30-12-2008 11:21 AM | 显示全部楼层 |阅读模式
各位,小弟写了一个vbscript来开excel file, 可是有error,我弄了很久,还是弄不到,想请各位前辈帮帮忙!
我的OS是window vista
Error Message是 the server threw an exception.
code是:-
Option Explicit

Dim ad
Dim sql_query
Dim objFSO, objOutFile
Dim intCount, i
Dim objExcel,objSheet, intRow,strExcelPath

Set objExcel = CreateObject("Excel.Application")
If (Err.Number <> 0) Then
    On Error GoTo 0
    Wscript.Echo "Excel application not found."
    Wscript.Quit
Else Wscript.Echo "Excel application found."
End If
On Error GoTo 0

strExcelPath = "C:\XXXX.xls"

objExcel.WorkBooks.open strExcelPath  ' Where place the the error Hit
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)



objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
回复

使用道具 举报


ADVERTISEMENT

发表于 30-12-2008 11:33 AM | 显示全部楼层
xxxxxxxxxxxxxxxx

答错了

[ 本帖最后由 shoeeo 于 30-12-2008 12:46 PM 编辑 ]
回复

使用道具 举报

 楼主| 发表于 30-12-2008 11:47 AM | 显示全部楼层
原帖由 shoeeo 于 30-12-2008 11:33 AM 发表
strExcelPath = "C:\\XXXX.xls"

escape word
\\

不明白
回复

使用道具 举报

发表于 30-12-2008 12:43 PM | 显示全部楼层
原帖由 Ryan1984 于 30-12-2008 11:47 AM 发表

不明白


不用想了,不是我说的问题,我说错了
等其他高手帮你吧
回复

使用道具 举报

发表于 30-12-2008 01:42 PM | 显示全部楼层
试下
http://www.microsoft.com/technet ... /mar05/hey0330.mspx

Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\Testsheet.xls"

objExcel.WorkBooks.open strExcelPath  ' Where place the the error Hit

open 的方法有点不同
回复

使用道具 举报

 楼主| 发表于 31-12-2008 10:24 AM | 显示全部楼层

回复 5# shoeeo 的帖子

对呀,这code在xp能用。
谢谢!!!:)

[ 本帖最后由 Ryan1984 于 31-12-2008 10:26 AM 编辑 ]
回复

使用道具 举报

Follow Us
您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 13-5-2024 09:25 AM , Processed in 0.055109 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表