MastaRelaxa
New member
- Local time
- Today, 04:50
- Joined
- Oct 24, 2019
- Messages
- 8
Hello-
I have been tasked by my manager to try and create a Macro we can use to pull multiple XML files into Access to review and analyze. All XML Files will have the same headers/tables. I did import the structure of the data from one of the XML files, figuring that all that would need to be done is importing of the XML files and appending the data to the already created tables. After research, this is what i came up with, although I am running into an error that is cannot find the file path. Below is the code that I have:
Sub TEST()
Dim fs
Dim fsFolder
Dim fsFile
Set fs = CreateObject("scripting.filesystemobject")
Set fsFolder = fs.getfolder("C:\Users\pierial\Desktop\XML")
For Each fsFile In fsFolder.files
Debug.Print fsFile.Name
Application.ImportXML "C:\Users\pierial\Desktop\XML" & fsFile.Name, acStructureAndData
Next fsFile
End Sub
Now if I use the Application.ImportXML along with Datasource, and only direct it to one file, then I am able to see results. When I do use the code above and it displays the error, it does show the path along with the file it is looking for. So it seems as if it is getting to the folder but not pulling anything out of the folder. Any help would be much appreciated!
Thanks!
I have been tasked by my manager to try and create a Macro we can use to pull multiple XML files into Access to review and analyze. All XML Files will have the same headers/tables. I did import the structure of the data from one of the XML files, figuring that all that would need to be done is importing of the XML files and appending the data to the already created tables. After research, this is what i came up with, although I am running into an error that is cannot find the file path. Below is the code that I have:
Sub TEST()
Dim fs
Dim fsFolder
Dim fsFile
Set fs = CreateObject("scripting.filesystemobject")
Set fsFolder = fs.getfolder("C:\Users\pierial\Desktop\XML")
For Each fsFile In fsFolder.files
Debug.Print fsFile.Name
Application.ImportXML "C:\Users\pierial\Desktop\XML" & fsFile.Name, acStructureAndData
Next fsFile
End Sub
Now if I use the Application.ImportXML along with Datasource, and only direct it to one file, then I am able to see results. When I do use the code above and it displays the error, it does show the path along with the file it is looking for. So it seems as if it is getting to the folder but not pulling anything out of the folder. Any help would be much appreciated!
Thanks!