Solved

Not importing XML data into Excel correctly

Posted on 2016-10-03
4
77 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

729 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