Re: Mouse pointer position, excel2002

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



'Put this bit at the top of your code window:

Declare Function GetUserName Lib "ADVAPI32.DLL" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
'adapted from a sub by Vasant
'used by Module_PopUp sub to get the mouse coordinates when a cell is
clicked
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As
Long
Type POINTAPI
X As Long
Y As Long
End Type

'used by Module_PopUp sub to get the mouse coordinates when a cell is
clicked
Function ShowPos() As Variant
Dim lRetVal As Long
Dim Pos As POINTAPI
Dim TempArray(1 To 2) As Long
lRetVal = GetCursorPos(Pos)
TempArray(1) = Pos.X
TempArray(2) = Pos.Y
ShowPos = TempArray
End Function

regards
Paul

.



Relevant Pages