Skip to content

Instantly share code, notes, and snippets.

@asynxc
Created September 28, 2016 21:05
Show Gist options
  • Save asynxc/549c1ce234fb3c1dc26a4bb4f34fb1f4 to your computer and use it in GitHub Desktop.
Save asynxc/549c1ce234fb3c1dc26a4bb4f34fb1f4 to your computer and use it in GitHub Desktop.
'Lbound Alternative Function
'MSVBVM60.__vbaLbound
Public Declare Function iLBound Lib "MSVBVM60" Alias "__vbaLbound" (ByVal ptr As Long, ByVal Exp As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Long, ByVal Length As Long)
Public Function Alternative_LBound(vbv As Variant) As Long
Dim a As Long
Dim aa As Long
a = VarPtr(vbv) + &H8
CopyMemory aa, ByVal a, &H4
CopyMemory a, ByVal aa, &H4
Alternative_LBound = iLBound(&H1, a)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment