Несоответствие типа PtrSave в объявлении API

#vba #declaration

Вопрос:

Мне нужна помощь. У меня есть объявление 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
 

Я благодарен за каждую помощь. Спасибо