-1

I've used google but i can't seem to find a simple answer to the following question:

How do I import a XML file into an Excel worksheet using VBA. So for example, i have a file named test.xml in the folder c:\test. I want excel to copy the data of test.xml to the second sheet using VBA

Regenbui
  • 181
  • 1
  • 3
  • 12
  • This question has been asked before: http://stackoverflow.com/questions/16423644/load-xml-into-excel-through-vba – teepee Mar 26 '14 at 15:58

1 Answers1

1

On the Data tab >> Get External Data >> From other sources >> From XML data import

Recording a macro while doing this gave me:

ActiveWorkbook.XmlImport URL:= "C:\Stuff\test.xml", ImportMap:=Nothing, _
                         Overwrite:=True, Destination:=Range("$A$1")

Start with that and see if it works for your file. If you run into problems you'll need to post a sample of the actual XML.

Tim Williams
  • 154,628
  • 8
  • 97
  • 125
  • Ok, this comes as a real supprise. I also used the macro tool, but afterword the code didn't work......Thnx for the feedback. – Regenbui Mar 26 '14 at 16:03