Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need example of how to loop thru dir while importing XML docs 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Can someone please refer me to an example that shows me how to loop through a directory containing several .xml files.
I need to import each xml file into a MS Access 2003 table and then delete each one when done with it.

Thanks in advance,

Steve728
 
You can use the FileSystemObject object or Dir.

Code:
ThePath="C:\Docs\"
TheFile=Dir(ThePath & "*.xml")

Do While TheFile<>""
'Import etc

'Delete
Kill ThePath & TheFile

'Next file
TheFile=Dir
Loop

FileSystemObject is an easier search term, so I will leave that to you.
 
Hi Remou

I immediately gave you a star because of your quick reply! Can you please now give me an example of how I can import the XML file into an existing table in my database using VBA? I can't find my code that I used a couple of years ago. I'm sure there are smarter ways of doing it now.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top