hello
i have a question about access 2010 vba
i am novice in programming
so please help me
i have main folder and
there are many sub folder in the main folder
in the subfolder, there are many xml files
my request
programming import all xml files in the first subfolder
and loop the import xml files from first to last subfolder
my main folder : C:\Users\Guest-1\Desktop\test
and sub folder name : C:\Users\Guest-1\Desktop\test\ te1
C:\Users\Guest-1\Desktop\test\ te2
C:\Users\Guest-1\Desktop\test\ te3
.....
i have a question about access 2010 vba
i am novice in programming
so please help me
i have main folder and
there are many sub folder in the main folder
in the subfolder, there are many xml files
my request
programming import all xml files in the first subfolder
and loop the import xml files from first to last subfolder
my main folder : C:\Users\Guest-1\Desktop\test
and sub folder name : C:\Users\Guest-1\Desktop\test\ te1
C:\Users\Guest-1\Desktop\test\ te2
C:\Users\Guest-1\Desktop\test\ te3
.....
Code:
Option Compare Database Private Sub cmdImport_Click() Dim strFile As String 'Filename Dim strFileList() As String 'File Array Dim intFile As Integer 'File Number Dim strPath As String ' Path to file folder strPath = "C:\Users\Guest-1\Desktop\test\" strFile = Dir(strPath & "*.XML") '''' While strFile <> "" 'add files to the list intFile = intFile + 1 ReDim Preserve strFileList(1 To intFile) strFileList(intFile) = strFile strFile = Dir() Wend 'see if any files were found If intFile = 0 Then MsgBox "No files found" Exit Sub End If 'cycle through the list of files For intFile = 1 To UBound(strFileList) Application.ImportXML strPath & strFileList(intFile), 2 Next intFile '''' MsgBox "Import Completed" End Sub
Comment