I am getting a Run-time error '429': ActiveX component can't create object
error when I try to run the following code.
Option Explicit
Private Sub EarlyVsLateBinding()
' References to both the Microsoft Scripting Runtime and Microsoft XML, v6.0
' are active so that early binding is possible
Dim EarlyDictionary As Scripting.Dictionary
Dim LateDictionary As Object
Set LateDictionary = CreateObject("Scripting.Dictionary")
Dim EarlyHTTP As New MSXML2.XMLHTTP60
Dim LateHTTP As Object
Set LateHTTP = CreateObject("MSXML2.XMLHTTP60") ' Error is thrown here
End Sub
I have included the example of Scripting.Dictionary
to convince myself that the CreateObject
function wasn't causing any issues, and to show that an early and late binding work for another class.
Sadly, every example that I come across of this class uses the early binding method but I need the late binding method for this code. Also, replacing the line Set LateHTTP = CreateObject("MSXML2.XMLHTTP60")
with Set LateHTTP = GetObject(Class:="MSXML2.XMLHTTP60")
yielded the same error.
What could be causing this error?