在Visual Basic脚本文件中 [英] In Visual Basic Script File
问题描述
我有一个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屋!