Kaja
Kaja

Reputation: 3057

ActiveX component can't create object: 'MSXML2.DOMDocument'

I am trying to create an instance of the object Msxml2.DOMDocument.4.0, but I am getting the following error: ActiveX component can't create object: 'MSXML2.DOMDocument'

The error occures in this line: Set xmlDoc = CreateObject("Msxml2.DOMDocument.4.0")

How can I solve this problem?

Thank you for your helps

Upvotes: 9

Views: 37681

Answers (3)

Sunam Debnath
Sunam Debnath

Reputation: 11

Three things you need to check:

  1. While registering MSXML4 make sure the MSXML4r.dll is at the same path as MSXML4.dll
  2. Register using proper syntax Regsvr32 msxml4.dll
  3. Enable 32 bit in IIS app pool

Upvotes: 0

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200453

Check if msxml4.dll exists on your system. and (re-)register the library if it does:

cd %SystemRoot%\system32
regsvr32 /u msxml4.dll
regsvr32 msxml4.dll

You need admin privileges to do this.

Upvotes: 6

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38765

Probably the specific version 4.0 of Msxml2.DOMDocument is not (properly) installed on the computer your script runs on. Try to create the version-independent object:

Set xmlDoc = CreateObject("Msxml2.DOMDocument")

This should give you the version that 'works' on your machine. If this fails, try

Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0")

or experiment with the version number. Use TypeName(xmlDoc) to get a hint wrt the effective version.

P.S. If your problem is caused by 32 vs. 64 bit troubles, this may give you further hints for things to check.

Upvotes: 18

Related Questions