“Type Mismatch” error message when you run a VBA macro in a 64-bit version of an Office 2010 application
Symptoms
Assume that you have a Microsoft Visual Basic for Applications (VBA) macro that runs correctly on a 32-bit version of a Microsoft Office application. However, this VBA macro does not run correctly in a 64-bit version of?a Microsoft Office 2010 application in a 64-bit version ofWindows.
Typically, this problem occurs when the VBA macro uses some Microsoft ActiveX Data Objects (ADO) APIs that are platform-dependent.?For example, you run a VBA macro that uses the RecordCount property of an ADO Recordset object in a way that resembles the following:
Dim rs as ADODB.Recordse
LONG recordCount
recordCount = rs.RecordCountIn this example, you receive a “Type Mismatch” error message when you run this macro on a 64-bit version of an Office 2010 application.
NotesYou can install the 64-bit version of Office 2010 in the following Windows operating systems:64-biteditions of Windows Server 2003 Service Pack 2 that haveMSXML 6.0 installedx64-based editions of Windows Vista Service Pack 1 and later versions64-biteditions of Windows Server 2008 and later versionsx64-based editions of Windows 7Windows Server 2008 R2?To view a list of ADO APIs that are platform dependent,?see the “More information” section.
Resolution
Some ADO APIs are platform dependent in ADO 2.7 and later versions. On 64-bit versions of?Windows, these ADO APIs process arguments by using a 64-bit data type (such as the LONGLONG data type). However, applications that use these APIs still use the LONG data type. Therefore, you receive a “Type Mismatch” error message when you try to run the macro.
