Solved

Not importing XML data into Excel correctly

Posted on 2016-10-03
4
82 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:Richard Kreidl
[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:Richard Kreidl
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:Richard Kreidl
ID: 41829604
Thanks for helping me out on this issue.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

623 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