|
-
Jul 21st, 2005, 01:23 PM
#1
Thread Starter
Fanatic Member
iterating through .xls files in a folder - [RESOLVED]
Greetings,
OK, I really appreciate eveyone's input here so far today. OK, now, I have a button on my VBA form, that when clicked should:
1) Open a folder C:\FSR
2) For each .xls file in that folder, go to "Tab 3" (which is the actual name of the third tab) and import external data to "tbl_Import_Temp", within the database being used, which is called "FinancialReports".
Any idea the syntax for that? Here is what I have thus far:
VB Code:
Private Sub cmdStep1_Click()
Dim cnnConnection As ADODB.Connection
Dim rstImportTemp As ADODB.Recordset
'Dim Detail As String
Set cnnConnection = CurrentProject.Connection
Set rstImportTemp = New ADODB.Recordset
rstImportTemp.Open "tbl_Import_Temp", cnnConnection, adOpenStatic, adLockReadOnly, adCmdTable
'open folder with Excel files
'for each file
'Get External Data for tab 3 and put it into tbl_Import_Temp, using the first row as headers.
'next i
MsgBox "Import of files, into the tbl_Import_Temp, is complete. Make sure the data looks OK; and then click the 'Step 2' button, below."
rstImportTemp.Close
Set rstImportTemp = Nothing
Set cnnConnection = Nothing
End Sub
Thank you,
Jim
Last edited by JimMuglia; Jul 22nd, 2005 at 10:38 AM.
Reason: provide clarification, as well as to indicate resolution
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|