Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 99
  • Last Modified:

Not importing XML data into Excel correctly

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:


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.

Richard Kreidl
Richard Kreidl
  • 2
  • 2
1 Solution
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...
Richard KreidlSoftware DeveloperAuthor Commented:
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?
i can add text after <TestA_BI> without it crashing if I write it like this:

I have however no clue if that is the format you want/need...
Richard KreidlSoftware DeveloperAuthor Commented:
Thanks for helping me out on this issue.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now