且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使VBA代码与Office 2010兼容-64位版本和较旧的Office版本

更新时间:2023-02-08 21:21:22

正如MSDN文章所述,请使用条件编译:它对我来说在Excel 97到Excel 2010 32位& 64位.

As the MSDN article says, use conditional compilation: it works well for me in Excel 97 through Excel 2010 32-bit & 64-bit.

#If VBA7 Then
Private Declare PtrSafe Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
#Else
Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
#End if