View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Thomas Risi Thomas Risi is offline
external usenet poster
 
Posts: 9
Default Custom Mouse over Cell Event Help

JLGWhiz schrieb:
You probably want a Java Script newsgroup.

"None" wrote:


Anyone know of any "Mouse over cell events?" Here is what I want to
do:

I want to create my own custom cell comments. I will have a few cells
merged and refer to them as my Comment Text Cell. I want to be able to
check if the mouse is moved over certain cells, and then have the
assigned text show up in my Comment Text Cell.



On my website, you'll find a com-addin named xlEventServer (description
is only in german; tested with german-excel, WinXP Home/Pro and
Win2000). It triggers some new events, like OnMove, OnButtonDown,
OnMouseWheel. But use on your own risk :-)

Install the addin, and add the following code to a normal code-module.

Option Explicit

Private BlockOnMove As Boolean
Public EnableWheelEvent As Boolean

Private Const DELTA_MOUSEWHEEL = 3&
Private Const DELTA_ZOOM = 5&

' Enables OnMouseWheel-Event ...
Public Function GetWheelState() As Boolean
'GetWheelState = EnableWheelEvent
GetWheelState = False
End Function

' OnMove-Event
Public Sub OnMove(Target As Excel.Range, x As Long, y As Long)

On Error Resume Next

If Not BlockOnMove And Selection.Count = 1 Then
Static oldRange As Excel.Range
oldRange.Interior.ColorIndex = oldRange.Interior.ColorIndex Xor 4
If Target.Interior.ColorIndex < 0 Then
Target.Interior.ColorIndex = 4
Else
Target.Interior.ColorIndex = Target.Interior.ColorIndex Xor 4
End If
Set oldRange = Target
End If

End Sub

--
Gruß
Thomas

http://rtsoftwaredevelopment.de