Loop through xml files and import each

A

argniw

I would like to loop through all xml files in a directory and use the
xml import method to append the data tables in my database. How would
I loop through the files in one directory and pass the file name to
that method?
 
P

pietlinden

I would like to loop through all xml files in a directory and use the
xml import method to append the data tables in my database. How would
I loop through the files in one directory and pass the file name to
that method?

Private Sub Command2_Click()
Dim strFile As String

strFile = Dir("C:\My Documents\*.xml")

Do Until strFile = ""
Application.ImportXML strFile, acAppendData
Debug.Print strFile
strFile = Dir
Loop


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top