我需要帮助。我有一个 API 声明,如果我使用的是 64 位 Excel,我会出现类型不匹配的错误。
声明:
' API 声明
#If VBA7 And Win64 Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" ( _
Destination As Any, _
Source As Any, _
ByVal Length As Long)
#Else
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" ( _
Destination As Any, _
Source As Any, _
ByVal Length As Long)
#End If
以及有错误的方法:
Public Function GetArrayDim(ByRef vArray As Variant) As Integer
' Handelt es sich überhaupt um ein Array?
Dim DimCount As Integer
DimCount = -1
If IsArray(vArray) Then
Dim vPtr As Long
DimCount = 0
vPtr = VarPtr(vArray) + 8
CopyMemory vPtr, ByVal vPtr, 4
CopyMemory vPtr, ByVal vPtr, 4
If vPtr Then
CopyMemory DimCount, ByVal vPtr, 2
End If
End If
GetArrayDim = DimCount
End Function
我感谢每一个帮助。谢谢