View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych Tim Zych is offline
external usenet poster
 
Posts: 389
Default Mouse Move Event

That was an example. Here is how I might implement this (not using globals).

' In a regular module
Sub DisplayMouseCoordinates(ByVal X As Single, ByVal Y As Single)
Debug.Print "X = " & CStr(X)
Debug.Print "Y = " & CStr(Y)
End Sub

' In a userform:
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Call DisplayMouseCoordinates(X, Y)
End Sub

--
Tim Zych
http://www.higherdata.com


"Tim Zych" <feedback at higherdata dt com wrote in message
...
This worked for me.

' In a regular module
Public gX As Single, gY As Single

' In a userform
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
gX = X
gY = Y
Debug.Print CStr("Does " & CStr(X) & " = " & CStr(gX) & "?")
Debug.Print CStr("Does " & CStr(Y) & " = " & CStr(gY) & "?")
End Sub


--
Tim Zych
http://www.higherdata.com


"Roger" wrote in message
...
I use the X & Y values in the mouse move event to make a comments box
follow
the mouse pointer - how can I pass the X & Y values to a different sub -
I
have declared them as public to no avail - they only work when they are
used
in the actual mouse move routine

I could reduce the amount of code I am using by a significant amount if
this
is possible - thanks in anticipation

--
Roger