Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Processing a set of Excel Files

I have a set of Excel files I need to process. I have
code to determine the name and number of Excel files in a
directory.

What would the code be to cyle through the list of Excel
files, open each one & then close it when I've finished my
processing operation?

Thanks for your response.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Processing a set of Excel Files

James,

Here is a basic code outline. I'm not sure how you have the list of file
names defined (array, defined name, cells on a worksheet, etc.).

Troy

Sub FileLoop()
Dim sFilename As String
Dim iNum As Integer
Dim ii As Integer

For ii = 1 To iNum
'Add logic here to assign sFilename to the next file.

Process_SingleFile sFile:=sFilename
Next ii
End Sub

Sub Process_SingleFile(sFile As String)
Dim wbFile As Workbook

'Open wbFile.
Set wbFile = Workbooks.Open(sFile)

'process wbFile here...

'Close wbFile and Save changes.
wbFile.Close SaveChanges:=True

Set wbFile = Nothing
End Sub


"James" wrote in message
...
I have a set of Excel files I need to process. I have
code to determine the name and number of Excel files in a
directory.

What would the code be to cyle through the list of Excel
files, open each one & then close it when I've finished my
processing operation?

Thanks for your response.




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
Cut and paste in Excel + processing David L[_2_] Excel Discussion (Misc queries) 0 February 12th 09 08:46 PM
Cut and paste in Excel + processing David L[_2_] Excel Discussion (Misc queries) 0 February 12th 09 08:45 PM
Excel processing rob Excel Discussion (Misc queries) 7 January 25th 09 04:28 PM
excel processing Wendy Elizabeth Excel Worksheet Functions 1 June 18th 07 05:17 PM
Reduce processing load in Excel Lance Gray Excel Discussion (Misc queries) 0 December 29th 05 05:26 PM


All times are GMT +1. The time now is 01:40 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"