Application.Speak Numbers with Spell

VulkaJohn

New Member
Joined
Sep 25, 2014
Messages
17
Application.Speech.Speak "< spell >110< /spell>", False, SpeakXML:=True speaks One One Zero

How can this be reproduced with a string variable (Dim say as string) with a value of 110

Application.Speech.Speak Say, False, SpeakXML:=True speaks One hundred and ten

How is the < spell > XML added to the variable?

Or is there another way to force numbers to be spoken as One One Zero rather than
One hundred and ten

Thanks

 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Is this what you want?

Code:
Sub SpeakNumbers()
    Dim say As String, char As Integer
    say = "0123456789"
    
    For char = 1 To Len(say)
        Application.Speech.Speak (Mid(say, char, 1))
    Next
End Sub
 
Last edited:
Upvote 0
Is this what you want?

Code:
Sub SpeakNumbers()
    Dim say As String, char As Integer
    say = "0123456789"
    
    For char = 1 To Len(say)
        Application.Speech.Speak (Mid(say, char, 1))
    Next
End Sub
Thanks Yongle that works like a charm.

Just one point, can your code be a single line like
For char = 1 To Len(say) Application.Speech.Speak (Mid(say, char, 1)) Next
I assume some punctuation is needed, if it can't, well that's fine also, again, my thanks.
 
Upvote 0
Why do you need 1 line :
Code:
For char = 1 To Len(say): Application.Speech.Speak (Mid(say, char, 1)): Next
 
Upvote 0
Thanks for the feedback (Your questions has already been answered by footoo) :)
 
Upvote 0
Why do you need 1 line :
Code:
For char = 1 To Len(say): Application.Speech.Speak (Mid(say, char, 1)): Next

I use speech to read back input forms which I activate through a userform with multiple lines which are identical except for the variable

I write and test the first line in VBA, when it works I copy the single line to a text editor with a column copy and replace feature

I then copy twenty lines of code, column delete the variables names (all same length), then column paste the 20 variables into the correct place

Copy the 20 lines into VBA, all done. Much quicker than editing a triple line code segment, it may not look pretty, but it works. I use the same method in writing HTML to display say 100 jpegs on the same page.

Thanks for your help, I am reasonably new to VBA and did not fully understand how to concatenate lines although I have been programming since 1980. Still learning new tricks!

Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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