Option
Explicit
Private
Declare
PtrSafe
Function
GetCursorPos
Lib
"user32"
( _
lpPoint
As
POINTAPI)
As
Long
Private
Type POINTAPI
x
As
Long
y
As
Long
End
Type
Private
Type RECT
Left
As
Long
Top
As
Long
Right
As
Long
Bottom
As
Long
End
Type
Sub
Test_SetzeMauscursor()
Dim
RECT1
As
RECT, Pt
As
POINTAPI
XlsPos2ScreenPos RECT1
With
RECT1
GetCursorPos Pt
If
Pt.x > .Left
And
Pt.y > .Top
And
Pt.x < .Right
And
Pt.y < .Bottom
Then
Application.Cursor = xlNorthwestArrow
Else
Application.Cursor = xlDefault
End
If
End
With
End
Sub
Function
XlsPos2ScreenPos(tRect
As
RECT)
As
Boolean
Dim
AC
As
Range
Set
AC = ActiveCell
With
ActiveWindow.ActivePane
tRect.Left = .PointsToScreenPixelsX(AC.Left)
tRect.Top = .PointsToScreenPixelsY(AC.Top)
tRect.Right = .PointsToScreenPixelsX(AC.Offset(0, 1).Left)
tRect.Bottom = .PointsToScreenPixelsY(AC.Offset(1, 0).Top)
End
With
End
Function