New*_*ser 5 vba ms-office 32bit-64bit
当我们迁移到office 2010-64位版本时,我发现了以下函数调用的问题.
Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Run Code Online (Sandbox Code Playgroud)
根据http://msdn.microsoft.com/en-us/library/ee691831.aspx链接提供的信息.我已经更改了上面的调用,它在Office 2010 64位版本上运行良好.
Private Declare PtrSafe Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Run Code Online (Sandbox Code Playgroud)
问题是,我需要同样调用以处理旧的Office版本,并且它会在旧版本上引发编译错误.
有谁知道如何使这个电话适用于办公室2010和旧办公室版本.
Cha*_*ams 11
正如MSDN文章所述,使用条件编译:它适用于Excel 97到Excel 2010 32位和64位.
#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
Run Code Online (Sandbox Code Playgroud)