I am using this VB code in Excel to create an audible stock quote when
the price of the stock change using Excel's 2002 SP3 speech recognition
capabilities.

The stock price is coming from a live feed from another software
program API that outputs the stock information to excel.

As the price(cell value) changes Speech playback calls out the new
stock price.

It works fine except when I open the excel spreadsheet initially I get
the VB error " run time error(13) type mismatch " on the the line
"curValue = [b7].Value2"
Cell B7 contains the stock quote data feed and as it changes the speech
recognition is activated.

When I get the error message , if I just press "Run" instead of "Debug"
then the program works fine. So it appears to be an issue in defining
the original value for "Oldvalue"

I am not a programmer and don't have any expertise in VB , so please
don't get too technical in any explanation.

Thanks, Here is what I have so far:


Option Explicit
Public Say As Speech
Public OldValue As Double
Public curValue As Double

Private Sub Worksheet_Activate()
OldValue = 1
End Sub

Private Sub Worksheet_Calculate()
If Say Is Nothing Then Set Say = Application.Speech

curValue = [b7].Value2
If OldValue <> curValue Then
OldValue = [b7].value
'Say.Speak " value of"
Say.Speak [b7].Text
'Say.Speak [B2].Text
End If
End Sub