Some VBA code no longer works for me, when creating COM objects from standard libraries such as Microsoft Scripting Runtime or Microsoft Xml, v6.0. I get an error on the line of instantiation, the error is code
80004021(-2147467231) and error description is Automation error The operation attempted is not supported. But I can create C# code with interop references to these libraries perfectly fine. I had an Windows 10 update KB4586781 two days ago.
The code fails in both Excel VBA and Word VBA. Anyone else with similar issues?
Sub TestCreate_Scripting_Dictionary()
'* THIS CODE FAILS !!!!
Dim lateBound As Object
Set lateBound = VBA.CreateObject("Scripting.Dictionary") '<=== FAILS 80004021
' ... Automation error The operation attempted is not supported.
'* Tools->References->Microsoft Scripting Runtime
Dim dict As Scripting.Dictionary
Set dict = New Scripting.Dictionary '<=== FAILS 80004021
' ... Automation error The operation attempted is not supported.
End Sub
Sub TestCreate_MSXML2_DOMDocument60()
'* THIS CODE FAILS !!!!
'* Tools->References->Microsoft Xml, v6.0
Dim xml As MSXML2.DOMDocument60
Set xml = New MSXML2.DOMDocument60 '<=== FAILS 80004021
' ... Automation error The operation attempted is not supported.
End Sub
UPDATE: I was meaning to reinstall but it went away without any intervention. Odd.