Run-time error '287'

jc0r

Board Regular
Joined
Mar 16, 2009
Messages
124
I have a macro that is activated using Windows Speech Recognition. When the macro is executed, i have a line of code that will repeat back to me as a confirmation. Most of the time the macro executes perfectly, however, on occasions, the function will still be performed but the final line of code, which is:

Application.Speech.Speak "just1"

produces the following error:

Run-time error '287': Application-defined or object-defined error

Does anyone know what could cause this intermittent problem?

Here is my full macro for referennce.

Many thanks

Sub just1()
Dim result As String
Dim sheet As Worksheet
Set sheet = ActiveWorkbook.Sheets("raw")
result1 = Application.WorksheetFunction.VLookup(1, sheet.Range("Y5:Z44"), 2, False)
Sheet3.Cells(4, 2) = result1
Application.Speech.Speak "just1"
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
You are DIM(ing) "result" but referring to "result1" Could this be an Issue?

Also, I'd change your Dim sheet As Worksheet (as sheet is too close to a reserved-key word) - I'd do: Dim mysht As Worksheet

Set mysht = ActiveWorkbook.Sheets("raw")
result1 = Application.WorksheetFunction.VLookup(1, mysht.Range("Y5:Z44"), 2, False)
 
Last edited:
Upvote 0
Many thanks for your response. In all honesty, all code ive ever written has been put together from my Googling and ive never actually known what all that Dim din stuff is at the top of a page! Thanks
 
Upvote 0

Forum statistics

Threads
1,215,534
Messages
6,125,374
Members
449,221
Latest member
chriscavsib

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top