1
votes

I'm currently working on late binding due to some issues with macros not working in Excel 2013 when they worked fine in 2010. Obviously, 2010 utilizes 14.0 object library whereas 2013 uses 15.0.

 Dim myHttpRequest As Object
 Dim myHttpHandler as Object

 Set myHttpRequest = CreateObject("MSXML2.XMLHTTP")
 Set myHttpHandler = CreateObject("CXMLHTTPHandler")

This yields an ActiveX cannot create object error. I've spent over a day looking into this.

Is there some sort of resource that has to be added in order for these objects to work? Do these objects even exist in Excel's 15.0 Object Library?

I'm completely at a loss of what to do as this usually works.

1

1 Answers

0
votes

I strongly suspect, looking at this post http://dailydoseofexcel.com/archives/2006/10/09/async-xmlhttp-calls/

that you are dealing with a user defined class. If that is the case you need to copy across that class, follow the steps outlined in the link, and then simply create a new instance of that class, without need for late binding as no library is involved.

An additional step is to convert code in that class to late bound as required if other libraries are early bound referenced.

As per that link:

Dim MyXmlHttpHandler As CXMLHTTPHandler

' Create an instance of the wrapper class.
Set MyXmlHttpHandler = New CXMLHTTPHandler

The additional steps quoting from that link are:

  1. Export and remove the CXMLHTTPHandler class to a known directory
  2. Open that file with notepad
  3. Find the OnReadyStateChange sub, and add this text after the signature:Attribute OnReadyStateChange.VB_UserMemId = 0
  4. Save, close and reimport the class module into the project