Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cut and paste in Excel + processing | Excel Discussion (Misc queries) | |||
Cut and paste in Excel + processing | Excel Discussion (Misc queries) | |||
Excel processing | Excel Discussion (Misc queries) | |||
excel processing | Excel Worksheet Functions | |||
Reduce processing load in Excel | Excel Discussion (Misc queries) |