Solved

Not importing XML data into Excel correctly

Posted on 2016-10-03
4
48 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
ID: 41827138
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
ID: 41827265
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
ID: 41828851
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
ID: 41829604
Thanks for helping me out on this issue.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hiding column macro 10 28
splitting text of cell to columns 14 22
Excel copy picture into Outlook email 7 41
Excel VBA When using VLookup 6 26
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…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

947 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

22 Experts available now in Live!

Get 1:1 Help Now