View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Custom Mouse over Cell Event Help

See, that's why I asked. APIs can be such a bother.

Personally, I'd let the user scroll. But a simpler solution might be to use
a timer to start code that looks for comments, and if a comment is visible,
make sure it is completely on screen.

Even easier would be to place a picture control from the controls toolbox
over the cell in question. Make the picture control invisible, then double
click on it in design mode, which brings you to the worksheet code module,
with the frame of the Image1_Click event procedure. Delete this one, but
select Image1 from the left dropdown of the code module, and MouseMove from
the right dropdown, then put the comment moving code in this procedure.

Make the procedure in the worksheet code module look like this:

Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, _
ByVal X As Single, ByVal Y As Single)
With Image1.TopLeftCell.Comment
.Visible = True
With .Shape
.Top = 100
.Left = 100
End With
Application.OnTime Now + TimeValue("0:00:10"), _
"'HideComment """ & Image1.TopLeftCell.Address & """'"
End With
End Sub

and put this procedure into a regular code module:

Sub HideComment(sAddress As String)
ActiveSheet.Range(sAddress).Comment.Visible = False
End Sub

The reason for this is that making the comment visible does not allow for
hiding it when you mouse away from the image control. This code hides it
after ten seconds.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"None" wrote in message
...

Glad you asked, maybe you know a fix for the issue I have with
comments. If I have a commnet on a cell that is close to the edge of
the viewable worksheet, it appears off the scrren. I know the user
can just use the horizonal scroll bar to move over, but this seems
"unclean" to me. I would have thought the programers of excel would
have at least allowed you to control where the comment would have
poped up.


And you can't use comments,... why?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"None" wrote in message
. ..
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.