Solved

How to use the mouse move event in cells to read the comments in the cells

Posted on 2016-11-02
23
103 Views
Last Modified: 2016-11-12
I have an Image control in my my excel worksheet.
I load pictures into the image ActiveX in the worksheet and add comments to a array of cells A4:D5.
Whenever the workbook is closed and opened the last picture loaded in the image control and the previous riddles (comments) appear, but i don't want it to be so.

When the worksheet is opened the riddles must appear only after the start button is pressed (The previous comments must be cleared when the worksheet is opened)

and

the pictures must load only after the user enters the answer and clicks the submit button.


I have been trying to work on  a mouse move even that will read the comments when the user moves the mouse over the cell to reveal the comment.

below is what i put down but i don't know how to connect it with the comments for them to be read.


Private Sub Cells_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)


Application.Speech.Speak "" & Selection.Comment.Text & "", True


End Sub

Open in new window

0
Comment
Question by:joseph narh padi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 10
23 Comments
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41870564
Can you attach your workbook, or a sample workbook?
0
 

Author Comment

by:joseph narh padi
ID: 41871233
Here is the file attached.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41871240
You forgot to attach the file.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

by:joseph narh padi
ID: 41871244
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41871314
What object is the Cells_MouseMove attached to?
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41871318
There is no MouseMove event for cells on a sheet but you can add this to the sheet's code.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Speech.Speak ActiveCell.Comment.Text & "", True
End Sub

Open in new window

0
 

Author Comment

by:joseph narh padi
ID: 41871392
It is how to attach that mouse move to the cell that i do not know
0
 

Author Comment

by:joseph narh padi
ID: 41871399
I added but it hasn't read it
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41871416
It is how to attach that mouse move to the cell that i do not know
That's not possible. There is no way to respond to a mouse move anyplace on a worksheet.
I added but it hasn't read it
Click any cell that has a comment in the attached workbook
28980423.xlsm
0
 

Author Comment

by:joseph narh padi
ID: 41871628
Thanks very much.
When i opened the workbook and clicked the cells, it read very well, but when i tried restarting the riddle, I had an error.
It reads

Object variable Or With block variable not set
The statement
Application.Speech.Speak ActiveCell.Comment.Text & "", True

Open in new window

is highlighted
0
 

Author Comment

by:joseph narh padi
ID: 41871629
Would you please look at the other issues for me?

I have an Image control in my my excel worksheet.
I load pictures into the image ActiveX in the worksheet and add comments to a array of cells A4:D5.
Whenever the workbook is closed and opened the last picture loaded in the image control and the previous riddles (comments) appear, but i don't want it to be so.

When the worksheet is opened the riddles must appear only after the start button is pressed (The previous comments must be cleared when the worksheet is opened)

and

the pictures must load only after the user enters the answer and clicks the submit button.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41872482
To correct the error, change
Application.Speech.Speak ActiveCell.Comment.Text & "", True

Open in new window

to
Dim c As Comment
Set c = ActiveCell.Comment 
If Not c Is Nothing Then
    Application.Speech.Speak ActiveCell.Comment.Text & "", True
End If

Open in new window


For the other issues, please close this question and ask a new one. Thanks.
1
 

Author Comment

by:joseph narh padi
ID: 41872498
Thanks. I'll give you feedback
0
 

Author Comment

by:joseph narh padi
ID: 41872937
Very good, It's working well, but we need to find a way of stopping the reading of one cell as soon as another cell is selected.
What happens is that when the programme assigns the comments to the cells, it highlights each cell in turn.
The programme also reads all the comments assigned one after the other long after they have been assigned.
If the first one will be stopped when the second cell is selected,  then only the comments in the last cell will be read.
The user will be spared the long waiting for all the comments to be read.
Thanks very much for your support.
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points (awarded by participants)
ID: 41872974
Change line 4 above to

Application.Speech.Speak ActiveCell.Comment.Text, True, , True

Here is a link to the Speech method.
0
 

Author Comment

by:joseph narh padi
ID: 41873192
WOW!!!!!!!!!!!!!!!!!! It works very well!!!!!!!!!!!!
Thanks very much. God bless you.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41873194
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
0
 

Author Comment

by:joseph narh padi
ID: 41873198
I wrote

Application.Speech.Speak ActiveCell.Comment.Text "", True, False, True

Open in new window

0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41873203
What does the " " do for you?
0
 

Author Comment

by:joseph narh padi
ID: 41873218
I've omitted something in it.
It is actually
Application.Speech.Speak ActiveCell.Comment.Text & "", True, False, True

Open in new window


When I first wrote the method

Application.Speech.Speak ActiveCell.Comment.Text, True 

Open in new window


it was not recognised and was giving an error (highlighted red)  until i added the  (& "")
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41873230
I don't understand but all that adding the " " does is to add a space at the end of the comment and since we are talking about speech, I don't think you need it.
0
 

Author Comment

by:joseph narh padi
ID: 41873237
thanks.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question