Skip to content

Instantly share code, notes, and snippets.

@yunga
Created August 17, 2015 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yunga/66d2cff12e32c2d2cbf0 to your computer and use it in GitHub Desktop.
Save yunga/66d2cff12e32c2d2cbf0 to your computer and use it in GitHub Desktop.
Use the speech api to say the clipboard content or the text entered in the input box
' Use the speech api to say the clipboard content or the text entered in the input box
Dim Message, Clip, SAPI
' Get Clipboard Text
Set objHTML = CreateObject("htmlfile")
Clip = objHTML.ParentWindow.ClipboardData.GetData("text")
If Clip = "" or IsEmpty(Clip) or IsNull(Clip) Then
Clip = "Hello World!"
End If
' User Input
Message = InputBox("Enter your text:", "Say it!", Clip)
' Speak
Set SAPI = CreateObject("sapi.spvoice")
SAPI.Speak Message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment