Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Posts
    9

    Unanswered: How can i automate the importing of several .xml files?

    File, Get ExternalData, Import, select next .xml file, options, Append

    I have a list of 83 .xml files which i'd like to import. I can do it manually one by one, but this this is something i will need to refresh frequently.

    I've got as far as :

    Sub GetExternalXML()
    Dim strfile As String
    ChDir ("\Import Folder")
    strfile = Dir("*.xml")
    Do While Len(strfile) > 0

    'I need this bit

    strfile = Dir
    Loop
    End Sub

    I just need the bit in the middle.

    Any ideas?

    james

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Having never specifically imported xml files I cannot be sure of the answer, however, with text files I believe the thing you're looking for is TransferText.

    Let me know if that works.
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2006
    Posts
    9
    Quote Originally Posted by georgev
    Having never specifically imported xml files I cannot be sure of the answer, however, with text files I believe the thing you're looking for is TransferText.

    Let me know if that works.
    No, these are .xml files. On Importing, Access works out which tables to create and populte. TransferText just dumps text. So i need a way to automate the process i outlined in the OP.

    Thanks anyway.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Can you upload a sample .xml file so I can have a further play with the problem.

    cheers

    EDIT: If you can create a macro to import a single file - it can be easily changed to loop through a directory/selection of files.
    Last edited by gvee; 02-12-07 at 09:31.
    George
    Home | Blog

  5. #5
    Join Date
    Aug 2006
    Posts
    9
    There doesn't seem to be a macro command for importing .xml, although they can be done singly from the menus.

    The whole point about .xml, is that Access knows how to read them and create tables from them.

    Does anyone have any experience of importing .xml?

    A typical example of one of the .xml files added.
    Attached Files Attached Files
    Last edited by severin1962; 02-12-07 at 11:07.

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If you could upload a simple sample XML file that'd be useful.
    (I have yet to learn about XML but I'm pretty good in access)
    I reckon if I could reproduce your import I could have a go at sorting this for you.
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •