Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Open all .xls files in a target folder, run macro then next

On Sep 1, 11:18*pm, Patrick Molloy
wrote:
If you want to process ALL the files in the folder, rather than selecting any
yourself, let the code do it...

filepath = "D:\root\child\*.xls"
filename = DIR(filepath)
DO WHILE filename < ""
' call your process ie your macro code
filename = DIR()
LOOP

"Forgone" wrote:
I've got a macro which I use at least 43 times a month and I'm
wondering what would be the best way to automate it.
Currently, I'm opening up each workbook manually, running the macro
which does something, saves the document and closes it. *The only
manual part is to open the workbook.


Each month, these workbooks are located in a different folder (eg: for
month) and I'm wondering what the best way to automate the "open
workbook, call existing macro" for each workbook in a target folder.
When the macro runs for the first time it would prompt the user for
the 'target' folder and off it runs.


The only thing is.... the folders change every month.....
It's the filepath = "obtain from user which filepath to use"
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
Open all .xls files in a target folder, run macro then next Forgone Excel Programming 6 September 2nd 09 01:53 PM
User selection of folder and open all .xls files within folder Barb Reinhardt Excel Programming 4 April 14th 07 01:41 PM
Excel macro to open files within a folder Craig[_24_] Excel Programming 2 October 8th 05 08:28 AM
Open files in folder - skip if already open Steph[_3_] Excel Programming 6 March 25th 05 06:49 PM
open all files in a folder and ... walt Excel Programming 5 August 7th 03 02:23 AM


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

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

About Us

"It's about Microsoft Excel"