Link to home
Start Free TrialLog in
Avatar of Iconica
Iconica

asked on

Extraction from XML file

I have a folder full of XML files and i want a VBA script that pulls all the data out of the XML File and put in a XLSX File and the data need to be in the correct column headings
TEST.xml
Book2.xlsx
ASKER CERTIFIED SOLUTION
Avatar of Jan Karel Pieterse
Jan Karel Pieterse
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What is on Sheet2? (the destination of the copy) Any merged cells on that sheet?
Avatar of Iconica
Iconica

ASKER

It doesn't look like it its the same xlsx spreadsheet that I have sent you unless i'm doing something wrong
I did not send you a file, just VBA code?
Avatar of Iconica

ASKER

Sorry what I ment was its the same Document im working of from the one that is attached to the original question I attached 2 files an xml and a xlsx  file and I have taken the VBA code and inserted this in excel and try to run the code and I selected the file I want to import then it copy's the data multiple times then errors
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Iconica

ASKER

Hi Again

Thank you for your help I am not getting any error messages now but what seems to be happening is that I have selected a few files to import but its not importing all of them only the last file to be imported.

if i'm importing the 1 file this is fine but if I am importing multiple files then this only imports the last file not all of the files.

Many thanks
Jon
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Excel just imports what the xml contains and copies that entirely.
Try opening one file with Excel by selecting the file type XML - see what Excel is 'importing', note that Excel is asking for a schema file, do you have one? You will see the same double rows because opening is basically the same as the XmlMap function is doing (without schema). Try opening that file with a schema file, does Excel import it now as expected?
Avatar of Iconica

ASKER

This is working fine now thanks for helping me out with this issue

Many Thanks
John
Avatar of Iconica

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for Iconica's comment #a40618390

for the following reason:

Great solution you need to copy the VB code into visual basic and run the code
Avatar of Iconica

ASKER

Responded very quickly and the solution is really good would definitely recommend