>I want to prevent the error "Class definition MSXML2.DOMDOCUMENT.4.0 is not found".
>
You could query the Registry and see if a specific key or value for a key
does exist.
HKEY_CLASSES_ROOT\CLSID\{88d969c0-f192-11d4-a65f-0040963251e5}\ProgID
for example should have a standard-value of
Msxml2.DOMDocument.4.0
If the key does not exist. It's not installed (You might like to look
for another key that is more sutable).
HTH