使用VBscript打开文件夹中的文件 [英] Using a VBscript to open up files in a folder

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

问题描述

我正在寻找构建一些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


http://social.technet.microsoft.com/Forums/en-US / ITCG /线程


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屋!

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