Error -1072896636 "DTD Prohibited" when opening xml file in Excel, what do I do?

Hanako Seishin picture Hanako Seishin · Mar 14, 2014 · Viewed 30.6k times · Source

I'm trying to open an XML file in Excel 2013, but it says it can't do that because "DTD prohibited". I've searched for the solution, but all I found are some pieces of code that are supposed to solve the problem.

But I don't get it at all! What code? I'm just opening the file, I'm not writing a program or anything. Should I recite that code aloud before opening a file or what? Sorry, but I find it really absurd.

Is there some solution to just open the file without writing a program for it? And if not, what should I do with this code?

The code I'm talking about is the following

Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0")
xmlDoc.setProperty "ProhibitDTD",False
xmlDoc.load xmltoload.xml

I've discovered that the file may be supposed to be opened in Word, not Excel, but the Word 2013 gives me the same error.

Answer:
It appeared the file was supposed to be opened in Excel after all. I've found on the Internet that Office 2007 and older doesn't prohibit DTD whatever that is. So I successfully bypassed the problem by opening the needed file in Excel 2003.

Answer

constra picture constra · Aug 31, 2016

The workaround is pretty easy. Open the XML file and delete the line that is referring to a DTD location. Excel will then create an XML schema according to your XML file.