View Single Post
  #5   Report Post  
Dana DeLouis
 
Posts: n/a
Default

Well, I've never tried it like a function along the lines that you want to
use it.
Looks like it works just fine. So, perhaps a more simple version...
You can place this on a regular module sheet...

Function Check(X, Y)
If X = Y Then
Application.Speech.Speak "Correct", True
Else
Application.Speech.Speak "Try Again", True
End If
End Function

On a worksheet...
=Check(A1,B1)

--
Dana DeLouis
Win XP & Office 2003


"Dana DeLouis" wrote in message
...
Hi TH. Here's a slightly different idea then a regular worksheet
function.
This simple demo has you place your numbers in the top row, and first
column.
Place this code on the worksheet module.
Then, you fill in the table as a multiplication table.
I threw in a Mod function to occasionally change the "correct" result.
Adjust sayings to your preferences.
HTH. :)

Option Explicit
Public Say As Speech ' <-- Make sure

Private Sub Worksheet_Change(ByVal Target As Range)
'= = = = = = = = = = = = = =
'// Place code on the sheet module
'// If your table of numbers is in the top row,
'// and left column, fill in the table
'// with the multiplication values.
'// Excel will speak the results.
'// Adjust sayings to what you would like.
'// By: Dana DeLouis
'= = = = = = = = = = = = = =

Dim R As Long
Dim C As Long

If Say Is Nothing Then Set Say = Application.Speech
R = Target.Row
C = Target.Column

'// Limit your range here...
If R = 1 Or C = 1 Then Exit Sub


Select Case Cells(R, 1) * Cells(1, C) = Target.Value
Case True
If Round(Rnd * 3) = 0 Then
Say.Speak "Excellent, John", True
Else
Say.Speak "Correct", True
End If
Case False
Say.Speak "Incorrect, please try again", True
End Select
End Sub


--
Dana DeLouis
Win XP & Office 2003


"TH" wrote in message
...
Jerry

I'm trying to teach my son times tables. If he types in the correct
answer I
would like excel to say "Correct" or "Try Again" if he gets it wrong.
Hence
the use of logic formula to generate the phrase. However while Excel will
speak the number he types in (once he presses return), it will not speak
the
phrase generated by the logical formula. I wondered if there was a
function
to place in the logic formula to make Excel speak the result. Hope ths
clarifies.


"Jerry W. Lewis" wrote:

If
=IF(X=Y,"A","B")
is not what you want, then try explaining in much greater detail.

Jerry

TH wrote:

I'd like to create a logical formula i.e. if X = Y, "A","B", and have
excel
speak the result. Any ideas ?