Solved

Not importing XML data into Excel correctly

Posted on 2016-10-03
4
34 Views
Last Modified: 2016-10-05
I have an Excel macro in which I run to import data from a XML file. Lately I've added some extra elements to the XML file and now it's not importing the data correctly.

In the XML file there are 3 sub elements for every main element:

TestA
    TestA_BI
    TestA_IM
    TestA_RS

The main element would have a time stamp within it and the other elements would have text.

When the 3 sub elements are blank the macro runs fine, but when one if the sub element has data within it the macro fails.

Try running the elements just with the main elements having a time stamp within them and then add some text to the sub elements and it shouldn't work.

Not sure what is happening.

Thanks
testingmacros.xlsm
Testing.xml
0
Comment
Question by:rkckjk
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Koen
Comment Utility
the only thing I see is that as soon as you add text to the sub elements your n.length becomes 0

It is then logical that your For iNode = 0 to n.Length - 1 returns an error...
0
 
LVL 2

Author Comment

by:rkckjk
Comment Utility
I understand what you're saying. Is there a solution to fix this issue while still maintaining the XML file sub- elements as they are?
0
 
LVL 8

Accepted Solution

by:
Koen earned 500 total points
Comment Utility
i can add text after <TestA_BI> without it crashing if I write it like this:
<TestA_BI>text</TestA_BI>

I have however no clue if that is the format you want/need...
0
 
LVL 2

Author Closing Comment

by:rkckjk
Comment Utility
Thanks for helping me out on this issue.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now