使用VBscript打开文件夹中的文件 [英] Using a VBscript to open up files in a folder
问题描述
我正在寻找构建一些VB脚本,它将打开文件夹中的文件(所有excel),然后在文件中运行宏。代码已经过设计,因此它作为循环运行。我目前的代码抛出错误说,找不到
文件(第一个文件),即使它已找到它的名称....代码---选项显式Dim FSO,FLD,FIL,objExcel Dim strFolder Set objExcel = Createobject(" Excel.Application")strFolder ='H:\ My Documents"'Set FSO = CreateObject(" Scripting.FileSystemObject")
set FLD = FSO.GetFolder(strFolder)For Each Fil In FLD.Files objExcel.workbooks.open Fil.Name objExcel.run" Macro"下一步objExcel.quit
尝试脚本人表单,此论坛适用于Visual Studio Net中的VB
Hi, I am looking to build some VB script that will open up the files (all excel) in a folder and then run the macro within the files. The code has been designed so it runs through as a loop. The code i currently have throws an error saying, Could not find file (first file) even though it has found its name.... code --- Option Explicit Dim FSO, FLD, FIL, objExcel Dim strFolder Set objExcel = Createobject ("Excel.Application") strFolder = 'H:\My Documents"' Set FSO = CreateObject("Scripting.FileSystemObject") set FLD = FSO.GetFolder(strFolder) For Each Fil In FLD.Files objExcel.workbooks.open Fil.Name objExcel.run "Macro" Next objExcel.quit
Try the scripting guys form, this forum is for VB in Visual Studio Net
http://social.technet.microsoft.com/Forums/en-US/ITCG/threads
这篇关于使用VBscript打开文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!