在Visual Basic脚本文件中 [英] In Visual Basic Script File

查看:81
本文介绍了在Visual Basic脚本文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个VB脚本文件,用于从数据库中提取数据,然后使用"FileSystemObject"写入Excel工作表文档。 / p>

当我们双击文件&在本地系统中安排任务。


但是我们可以在Windows 2000 Server中安排任务,它不会更新Excel工作表文档。


I想想,Excel.exe没有在这个过程中运行。任何人都可以告诉我是否需要做些什么来解决这个问题。


代码:



Set


Set objFSO = CreateObject(" Scripting.FileSystemObject")


Set objFile = objFSO.GetFile(cReportLocation& strFileName)


objFile.Attributes = 0
'normal


Set objWkb = objXL.Workbooks.Open(cReportLocation& strFileName)


提前致谢


Chitrarasan.G


解决方案

" cReportLocation& strFileName"的价值是什么?它是否具有所有适当的"\"?你可以使用MsgBox" ; cReportLocation& strFileName"以验证
路径对.xls文件是否有效。


Hi,

I have a VB script file for the pull the datas from the database and then write to the Excel sheet document using the "FileSystemObject".

It will work fine when we double click the file & Schedule the task in local system.

But we can schedule the task in the Windows 2000 Server it will not update the Excel sheet document.

I think,Excel.exe is not running in the process.Can any one advise me whether what i have to do for resolving the issue.

Code:

Set objXL = CreateObject("Excel.Application")

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(cReportLocation & strFileName)

objFile.Attributes = 0 ' normal

Set objWkb = objXL.Workbooks.Open(cReportLocation & strFileName)

Thanks in Advance

Chitrarasan.G

解决方案

What is the value of "cReportLocation & strFileName"? Does it have all of the appropriate "\"? You can use the MsgBox "cReportLocation & strFileName" to verify that the path is valid to the .xls file.


这篇关于在Visual Basic脚本文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆