Importing XML Crashes Excel

末鹿安然 提交于 2019-12-05 15:56:04

I posted this question after I found the answer just because this was such a disaster for me, and had plagued me for months. Hopefully this post will keep someone else from pulling their hair out like I did for so long.

The fix is pretty simple. What happens is every time excel imports an xml file, it stores an xmlmap in that spreadsheet. So if you use the same spreadsheet and keep saving it, these build up over time. The best solution I have found is to just delete these xml maps, or reuse the same one (the latter is not a good option many times).

Here is some code to delete all of them (I just run this before the code I included in my question):

Dim XmlMap as XmlMap
    For Each XmlMap In ActiveWorkbook.XmlMaps
        XmlMap.Delete
    Next

Is there a chance the input XML has some illegal / unescaped characters?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!