I'm having trouble declaring new object using CreateObject()
Sub A()
Dim x
'This works
Set x = CreateObject("Scripting.FileSystemObject")
Set x = Nothing
'This throws an error 429 "Active component cannot create object."
Set x = CreateObject("MSXML2.DOMDocument60")
Set x = Nothing
'The only way I can create object is to add the reference using GUID
Dim y As MSXML2.DOMDocument60
Set y = New MSXML2.DOMDocument60
Set y = Nothing
'This works like a charm
End Sub
I don't understand why "scripting" works and "MSXML2" does not.
I'm using MS Access 2010 32 bit on Windows 7 64 bit.
Set x = New MSXML2.DOMDocument60
-- This way potential errors will occur at compile time not at runtime. For this to work you have to add a reference (Tools --> References) to Microsoft XML, v6.0 – Engrossment