Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default VBS for all xls in a folder

Hello, how can I have three vbs that I have, run all on excel files in a
folder. 1 vbs formats the file, the other subtotals it, and the other
freezes the panes. I'm going to merge them all, but I want the vbs to run
for all xl files in the folder, not for just C:\test.xls is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VBS for all xls in a folder

Sub ProcessAll()
Dim s as String
Dim f as String
f = "C:\My Folder\"
s = Dir(f & "*.xls")
do while s < ""
set bk = workbooks.Open(f & s)
' process the workbook
bk.Close Savechanges:=True
s = dir()
Loop
end Sub

is one approach.

--
Regards,
Tom Ogilvy



"JavyD" wrote:

Hello, how can I have three vbs that I have, run all on excel files in a
folder. 1 vbs formats the file, the other subtotals it, and the other
freezes the panes. I'm going to merge them all, but I want the vbs to run
for all xl files in the folder, not for just C:\test.xls is this possible?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM


All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"