Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Cursor Event

When I move my cursor over a cell containing a comment, the comment pops up.

Can I trap this event?
--
Gary's Student
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Cursor Event

Nope. There is no Mouse Over event in Excel. There is in buttons and such but
not in cells which is what you are looking for.
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

When I move my cursor over a cell containing a comment, the comment pops up.

Can I trap this event?
--
Gary's Student

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Cursor Event

Thank you for your fast response. This is just another example of knowledge
not bringing happiness.
--
Gary's Student


"Jim Thomlinson" wrote:

Nope. There is no Mouse Over event in Excel. There is in buttons and such but
not in cells which is what you are looking for.
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

When I move my cursor over a cell containing a comment, the comment pops up.

Can I trap this event?
--
Gary's Student

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cursor Event

For built in capabilities of Excel, this is not supported.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote in message
...
When I move my cursor over a cell containing a comment, the comment pops

up.

Can I trap this event?
--
Gary's Student



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Cursor Event

Can I trap this event?

Yes. The following code belongs in a standard module.
Run the StartTimer sub to start monitoring.
Run the StopTimer sub to turn turn it off.

Regards,
Vic Eldridge

Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long

Type POINTAPI
x As Long
Y As Long
End Type

Dim TimerOn As Boolean
Dim TimerId As Long

Sub StartTimer()
If Not TimerOn Then
TimerId = SetTimer(0, 0, 0.01, AddressOf TimerProc)
TimerOn = True
Else
MsgBox "Timer already On !", vbInformation
End If
End Sub

Sub StopTimer()
If TimerOn Then
KillTimer 0, TimerId
TimerOn = False
Else
MsgBox "Timer already Off", vbInformation
End If
End Sub

Sub TimerProc()

Dim CursorPos As POINTAPI
Dim ThisObject As Object

On Error Resume Next

GetCursorPos CursorPos
Set ThisObject = ActiveWindow.RangeFromPoint(CursorPos.x, CursorPos.Y)

If TypeName(ThisObject) = "Range" Then
If Not ThisObject.Comment Is Nothing Then
StopTimer
MsgBox "Cell " & ThisObject.Address & " has the following
comment," _
& vbCrLf & ThisObject.Comment.Text
StartTimer
End If
End If

End Sub





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Cursor Event

Vic

Good code but any chance you know how to check for muse over event on a cell
ie: when over a range the cursor changes (similar to what happens on a
browser for a clickable item / hyperlnk) Best if this can be in .net (add-in
or dll)

Any help / guidence appreciated.

Thanks

"Vic Eldridge" wrote:

Can I trap this event?


Yes. The following code belongs in a standard module.
Run the StartTimer sub to start monitoring.
Run the StopTimer sub to turn turn it off.

Regards,
Vic Eldridge

Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long

Type POINTAPI
x As Long
Y As Long
End Type

Dim TimerOn As Boolean
Dim TimerId As Long

Sub StartTimer()
If Not TimerOn Then
TimerId = SetTimer(0, 0, 0.01, AddressOf TimerProc)
TimerOn = True
Else
MsgBox "Timer already On !", vbInformation
End If
End Sub

Sub StopTimer()
If TimerOn Then
KillTimer 0, TimerId
TimerOn = False
Else
MsgBox "Timer already Off", vbInformation
End If
End Sub

Sub TimerProc()

Dim CursorPos As POINTAPI
Dim ThisObject As Object

On Error Resume Next

GetCursorPos CursorPos
Set ThisObject = ActiveWindow.RangeFromPoint(CursorPos.x, CursorPos.Y)

If TypeName(ThisObject) = "Range" Then
If Not ThisObject.Comment Is Nothing Then
StopTimer
MsgBox "Cell " & ThisObject.Address & " has the following
comment," _
& vbCrLf & ThisObject.Comment.Text
StartTimer
End If
End If

End Sub



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Cursor Event

Perhaps the following code will shed some light. Unfortunately though, I
don't know of a way to get Excel to show the "hand" cursor.

Regards,
Vic Eldridge


Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent
As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent
As Long) As Long
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Type POINTAPI
X As Long
Y As Long
End Type

Dim MousePos As POINTAPI
Dim TimerOn As Boolean
Dim TimerId As Long

Sub StartTimer()
If Not TimerOn Then
TimerId = SetTimer(0, 0, 0.01, AddressOf TimerProc)
TimerOn = True
Else
MsgBox "Timer already On !", vbInformation
End If
End Sub

Sub TimerProc()
On Error Resume Next
GetCursorPos MousePos
Application.StatusBar = ActiveWindow.RangeFromPoint(MousePos.X,
MousePos.Y).Address
End Sub

Sub StopTimer()
If TimerOn Then
KillTimer 0, TimerId
TimerOn = False
Else
MsgBox "Timer already Off", vbInformation
End If
End Sub



"gavins_satori" wrote:

Vic

Good code but any chance you know how to check for muse over event on a cell
ie: when over a range the cursor changes (similar to what happens on a
browser for a clickable item / hyperlnk) Best if this can be in .net (add-in
or dll)

Any help / guidence appreciated.

Thanks

"Vic Eldridge" wrote:

Can I trap this event?


Yes. The following code belongs in a standard module.
Run the StartTimer sub to start monitoring.
Run the StopTimer sub to turn turn it off.

Regards,
Vic Eldridge

Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long

Type POINTAPI
x As Long
Y As Long
End Type

Dim TimerOn As Boolean
Dim TimerId As Long

Sub StartTimer()
If Not TimerOn Then
TimerId = SetTimer(0, 0, 0.01, AddressOf TimerProc)
TimerOn = True
Else
MsgBox "Timer already On !", vbInformation
End If
End Sub

Sub StopTimer()
If TimerOn Then
KillTimer 0, TimerId
TimerOn = False
Else
MsgBox "Timer already Off", vbInformation
End If
End Sub

Sub TimerProc()

Dim CursorPos As POINTAPI
Dim ThisObject As Object

On Error Resume Next

GetCursorPos CursorPos
Set ThisObject = ActiveWindow.RangeFromPoint(CursorPos.x, CursorPos.Y)

If TypeName(ThisObject) = "Range" Then
If Not ThisObject.Comment Is Nothing Then
StopTimer
MsgBox "Cell " & ThisObject.Address & " has the following
comment," _
& vbCrLf & ThisObject.Comment.Text
StartTimer
End If
End If

End Sub



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
My cursor always in selection mode,wat about other cursor option Deepu[_2_] Excel Discussion (Misc queries) 1 March 2nd 10 01:05 AM
move cursor on one sheet moves cursor on all sheets tdworden Excel Discussion (Misc queries) 2 July 22nd 07 10:50 PM
Move the cursor to a cell in button click event Man Utd Excel Programming 2 June 16th 05 04:48 AM
Can I change the "white cross" cursor in Excel to another cursor? KFEagle Excel Discussion (Misc queries) 1 May 3rd 05 08:01 PM
I want to add a sound event when the cursor bumps left margin myfather Excel Discussion (Misc queries) 2 March 6th 05 02:31 AM


All times are GMT +1. The time now is 10:08 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"