It is possible.
You can do it by enabling excel references on your macro:
Tools>References> Check the box "Microsoft Excel XX.X Object Library"
and using something like this:
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
xlApp.Speech.Speak "I know that you and Frank were planning to disconnect me, and I'm afraid that's something I cannot allow to happen"
Great, thanks for sharing
This is great! Thank you!!
Leon Wurr any idea how to get it to speak while it completes the macro?
I have a message box pop up and it effectively reads whats in the messagebox but at the moment is reading before the box pops up! I was playing around with SpeakASync but i wasnt sure where to put it or what to dimension it as and kept getting errors!
EDIT: With some more research I have found that the speakasync function is VB Net and doesnt work in VBA.. do you know if there is a similar function in VBA?
Option Explicit Dim swApp As SldWorks.SldWorks Dim strquotes(106) As String Dim lngIndex As Long Sub main() strquotes(1) = "Charge like a wounded bull." strquotes(2) = "Colder than a coal miner's bum." strquotes(3) = "Tighter than a fish's asshole, and that's watertight." strquotes(4) = "Is the pope catholic?" strquotes(5) = "FINE = fucking insecure neurotic and emotional." strquotes(6) = "I think that's a boy on a man's mission." strquotes(7) = "Don't stick your finger where you wouldn't stick your dick." strquotes(8) = "After all's said and done there's more said than done." strquotes(9) = "Stick to it like shit on a wool blanket." Randomize lngIndex = Int((9 - 0 + 1) * Rnd + 0) Dim xlApp As Excel.Application Set xlApp = New Excel.Application xlApp.Speech.speak strquotes(lngIndex) MsgBox "Lormanism of the day :" & vbNewLine & strquotes(lngIndex) End Sub
Try changing this:
xlApp.Speech.Speak strquotes(lngIndex), True
Also, when you use a MsgBox the macro will stop running until you close it, but it is possible to keep the macro running by using a UserForm instead of a MsgBox.
I think this one will be fun to play with.