Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to get position of mouse via VB in a worksheet

I would like to monitor the position of the mouse in a worksheet and react to
this.

So when the mouse moves an event triggered which reports the x,y position
and if possible the cell under the current location of the mouse. If the x,y
position is recorded I would need to know the x,y limits of the worksheet and
the view limit of the cells on the screen.

I would be grateful for any help given.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to get position of mouse via VB in a worksheet

See:

http://groups.google.com/group/micro...e7b532c96d7a1a


--
Gary''s Student - gsnu200829


"ratty" wrote:

I would like to monitor the position of the mouse in a worksheet and react to
this.

So when the mouse moves an event triggered which reports the x,y position
and if possible the cell under the current location of the mouse. If the x,y
position is recorded I would need to know the x,y limits of the worksheet and
the view limit of the cells on the screen.

I would be grateful for any help given.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to get position of mouse via VB in a worksheet

Here is some really simple code to sample or set the mouse position:

Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long


Type POINTAPI
x As Long
y As Long
End Type

Declare Function SetCursorPos Lib "user32" ( _
ByVal x As Long, _
ByVal y As Long _
) As Long
Sub ShowPos()
Dim lRetVal As Long
Dim Pos As POINTAPI
lRetVal = GetCursorPos(Pos)
MsgBox Pos.x & ", " & Pos.y
End Sub

Sub SetPos()
Dim retv As Long
retv = SetCursorPos(67, 139)
End Sub

--
Gary''s Student - gsnu200829


"ratty" wrote:

I would like to monitor the position of the mouse in a worksheet and react to
this.

So when the mouse moves an event triggered which reports the x,y position
and if possible the cell under the current location of the mouse. If the x,y
position is recorded I would need to know the x,y limits of the worksheet and
the view limit of the cells on the screen.

I would be grateful for any help given.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse Position Jason Zischke Excel Programming 1 May 21st 07 06:39 AM
Position of the mouse pointer Liam Excel Programming 5 October 26th 06 02:20 PM
mouse position in EXCEL Franz Excel Programming 6 February 11th 05 05:55 PM
Mouse Position Max Potters Excel Programming 3 September 28th 04 06:09 PM
position mouse cursor in msg box swatsp0p[_2_] Excel Programming 2 September 24th 04 07:12 AM


All times are GMT +1. The time now is 05:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"