Sub MouseWheel(control As Object, Optional yy As Single = 0, Optional pilote As control = Nothing)
Const WHEEL_DELTA = 120&, WM_MOUSEWHEEL = &H20A, PM_NOREMOVE = &H0&
Dim tMsg As Msg, lDelta As Integer, pos As POINTAPI, criter As Boolean, rc As Rect
Dim PosControl As IAccessible, MouseControl As IAccessible
Set MouseControl = control
Do
GetCursorPos pos
[B2] = TypeName(ActiveWindow.RangeFromPoint(pos.X, pos.Y))
If Not TypeOf control.Parent Is Worksheet Then
#If Win64 Then
Dim lngPtr As LongPtr
CopyMemory lngPtr, pos, LenB(pos)
AccessibleObjectFromPoint lngPtr, PosControl, 0
#Else
AccessibleObjectFromPoint pos.X, pos.Y, PosControl, 0
#End If
If PosControl Is Nothing Then Exit Sub
criter = (PosControl.accName = MouseControl.accName)
Else
If TypeName(ActiveWindow.RangeFromPoint(pos.X, pos.Y)) = "OLEObject" Then
criter = True
ActiveSheet.ScrollArea = "A1"
Else: criter = False: ActiveSheet.ScrollArea = Cells.Address
End If
End If
If Not criter Then RecallLoop = False: Exit Sub