joseph narh padi
asked on
How to use the mouse move event in cells to read the comments in the cells
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.
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
Can you attach your workbook, or a sample workbook?
ASKER
Here is the file attached.
You forgot to attach the file.
What object is the Cells_MouseMove attached to?
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
ASKER
It is how to attach that mouse move to the cell that i do not know
ASKER
I added but it hasn't read it
It is how to attach that mouse move to the cell that i do not knowThat's not possible. There is no way to respond to a mouse move anyplace on a worksheet.
I added but it hasn't read itClick any cell that has a comment in the attached workbook
28980423.xlsm
ASKER
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
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
is highlighted
ASKER
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.
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.
To correct the error, change
For the other issues, please close this question and ask a new one. Thanks.
Application.Speech.Speak ActiveCell.Comment.Text & "", True
toDim c As Comment
Set c = ActiveCell.Comment
If Not c Is Nothing Then
Application.Speech.Speak ActiveCell.Comment.Text & "", True
End If
For the other issues, please close this question and ask a new one. Thanks.
ASKER
Thanks. I'll give you feedback
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
WOW!!!!!!!!!!!!!!!!!! It works very well!!!!!!!!!!!!
Thanks very much. God bless you.
Thanks very much. God bless you.
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
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
ASKER
I wrote
Application.Speech.Speak ActiveCell.Comment.Text "", True, False, True
What does the " " do for you?
ASKER
I've omitted something in it.
It is actually
When I first wrote the method
it was not recognised and was giving an error (highlighted red) until i added the (& "")
It is actually
Application.Speech.Speak ActiveCell.Comment.Text & "", True, False, True
When I first wrote the method
Application.Speech.Speak ActiveCell.Comment.Text, True
it was not recognised and was giving an error (highlighted red) until i added the (& "")
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.
ASKER
thanks.