Dim lngX As Long
Dim lngY As Long
Dim lngReturn As Long
Dim NewRect As RECT
'Get the screens Twips per pixel (form's scalemode must be Twips)
lngX = Screen.TwipsPerPixelX
lngY = Screen.TwipsPerPixelY
'Set cursor region to that of form
With NewRect
.Left = Me.Left / lngX
.Top = Me.Top / lngY
.Right = .Left + Me.Width / lngX
.Bottom = .Top + Me.Height / lngY
End With
lngReturn = ClipCursor(NewRect)