Tim Francis-Wright
Board Regular
- Joined
- Feb 19, 2002
- Messages
- 76
- Office Version
- 2013
- Platform
- Windows
I maintain spreadsheets at work that have a number of macros in them, and it's almost time to upgrade the Excel that everyone uses from 2013 to 2016. For most of the macros, the change matters not at all, but two of the macros interact with other programs, and (of course) they use early binding. Right now, the one person using Office 2016 has anyone using the new Excel has been saving his work, and when his Office 2013 colleagues open the file, they get a (fatal) error because Excel 2013 cannot access the Office 16.0 Object Library.
I know the way around this is to use late binding instead of early binding; I was able to fix Problem Macro A (which interacts with Outlook). But Problem Macro B is still a problem.
Here is the existing, early binding code snippet:
That code works fine on my machine, which has the following references:
I attempted to convert PMB to late binding:
I have seen in different places other possibilities for the CreateObject reference ("MSXML2.XMLHTTP30", "MSXML2.XMLHTTP", "MSXML2.XMLHTTP60", etc.) None work. The error I consistently get is 429, "ActiveX component can't create object." What do I need to do to get late binding to work here?
I know the way around this is to use late binding instead of early binding; I was able to fix Problem Macro A (which interacts with Outlook). But Problem Macro B is still a problem.
Here is the existing, early binding code snippet:
VBA Code:
'Problem Macro B ("PMB")
Dim requestXML As New MSXML2.XMLHTTP30
'Other, potentially sensitive lines excised
That code works fine on my machine, which has the following references:
Rich (BB code):
Visual Basic for Applications
Microsoft Excel 15.0 Object Library
Microsoft Forms 2.0 Object Library
Microsoft XML, v6.0
I attempted to convert PMB to late binding:
VBA Code:
Dim requestXML As Object
Set requestXML = CreateObject("MSXML2.XMLHTTP.3.0")
I have seen in different places other possibilities for the CreateObject reference ("MSXML2.XMLHTTP30", "MSXML2.XMLHTTP", "MSXML2.XMLHTTP60", etc.) None work. The error I consistently get is 429, "ActiveX component can't create object." What do I need to do to get late binding to work here?