Solved

Not importing XML data into Excel correctly

Posted on 2016-10-03
4
73 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ActiveX component can't create object VBA how to fix it 6 60
NEED TO LOOK FOR EXACT NUMBER 14 43
NEED LOOK FOR NUM 23 29
Cannot locate cell 15 41
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…
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.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

732 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