7

I recently changed "MSXML2.DOMDocument" to "MSXML2.DOMDocument40" because of some reason.It works in my Computer.But the same code doesnt work in another computer. What might be the reason? Please suggest some answer.

2
  • 2
    What does "doesn't work" look like? Oct 11, 2012 at 14:59
  • 1
    @TimWilliams:Im sorry for the wrong post.That is actually working fine.Im not gonna delete this post since "Barrowc" below have put some useful info.And I haven`t found the post in this website. Oct 12, 2012 at 6:16

1 Answer 1

27

MSXML2.DOMDocument is always a synonym for MSXML2.DOMDocument30. This corresponds to the library referenced by "Microsoft XML, v3.0" in VBA (msxml3.dll)

Microsoft recommend that developers should target the "Microsoft XML, v6.0" library (msxml6.dll) in their applications. This would be done by setting a reference to that library and then using the appropriate types - e.g. MSXML2.DOMDocument60.

If using the v6.0 library is not possible then developers should fall back on the "Microsoft XML, v3.0" library (msxml3.dll) instead.

Using any other version of the XML library is not recommended as there is no guarantee that any versions other than v6.0 and v3.0 will be available on a given system. The MSXML2.DOMDocument40 which you used corresponds to the "Microsoft XML, v4.0" library (msxml4.dll) and it is very likely that the computer where this code doesn't run simply doesn't have that library available.

For full details see http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx

edit: if using late binding, you can find the appropriate ProgIDs here. For DOMDocument60, you would use CreateObject("Msxml2.DOMDocument.6.0")

2
  • :Im sorry there was a mistake in my code.That is actually works fine,do you recomend not to use "MSXML2.DOMDocument40" still?Because im gonna put the file in other systems too.BUt when I did search in my system with all dlls like "msxml3.dll",msxml4.dll,msxml6.dll i found these in C:\Windows folder and in other folders too.Please suggest. Oct 12, 2012 at 6:29
  • 1
    I would go with Microsoft's recommendation and use version 6.0 (msxml6.dll) only. If that wasn't possible I would use version 3.0. I wouldn't use versions 4.0 or 5.0 in any circumstances
    – barrowc
    Oct 12, 2012 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.