Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default For each File in Folder, open?

I like to specify a folder, then have the excel files in the folder open one
at a time for a macro to run on it. How can I do that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default For each File in Folder, open?

maybe something like this:

Sub GetFileList()
Dim ThePath As String
Dim fname As String
Dim i As Long
ThePath = ThisWorkbook.Path
fname = Dir(ThePath & "\*.xls")
i = 1
Do While fname < ""
On Error Resume Next
Workbooks.Open Filename:=fname
On Error GoTo 0
fname = Dir()
i = i + 1
Loop
End Sub


--


Gary


"J@Y" wrote in message
...
I like to specify a folder, then have the excel files in the folder open one
at a time for a macro to run on it. How can I do that?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default For each File in Folder, open?

See also this example
http://www.rondebruin.nl/copy4.htm

You can change the copy/chnage code to your code



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"J@Y" wrote in message ...
I like to specify a folder, then have the excel files in the folder open one
at a time for a macro to run on it. How can I do that?

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
How to open each file from the folder and save again L.K. Excel Programming 3 March 27th 07 11:46 AM
Open File in Folder CV323 Excel Programming 11 March 8th 07 03:39 AM
Open the last file in a folder Spike Excel Programming 3 April 6th 06 10:37 AM
open file from folder save in new folder tim64[_3_] Excel Programming 20 June 17th 05 07:58 PM
How can i open a folder or file ΒΟΥΛΓΑΡΑΚΗΣ ΓΙΩΡΓΟΣ ΒΟΡΑΣ Excel Programming 2 November 2nd 04 03:20 PM


All times are GMT +1. The time now is 01:41 PM.

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"