The best line of VBA ever

Okay, I'll admit that you probably have to be a parent of a young child to agree with this, but here it is:

[code]Application.Speech.Speak Target[/code]

This all started when I showed my kid how fast the computer could count to 100 with this code:

[code]Sub Count()
Dim lCount As Long

For lCount = 1 To 100
With ActiveCell
.Value = lCount
.Offset(1, 0).Select
End With
Next lCount
End Sub[/code]

We then moved up to "Wow, Daddy! Can it go to 1000?" Then eventually it was a contest to see if she could get her pyjamas on faster than the computer could count to 10,000.

This weekend, though, when testing out my new article on Having Excel Read a Range of Data to You, (written for someone who emailed me through the site,) I made the computer count to 10 out loud.

She was fascinated. Then we started with words...

The conversations got more complex line by line, with her talking to "Laptop". It took over 178 lines of conversation until Laptop finally sent her to bed. Great fun! (I will admit that I have a little fear that I just turned my laptop into a new game though!) 😉



6 thoughts on “The best line of VBA ever

  1. Ken, I may have missed the point, is there not a text to speach toolbar that does this already?

  2. I agree with you that this is the best line of VBA ever... data validation will never be the same for my clients.

    "Error: There are no consonants in a dollar amount"
    "Error: Nice try, why don't you take a break and try again later"
    "Error: You fat-fingered the value... try exercising"

  3. LOL! That's beautiful!

    I can just see someone logging the attempts for a certain cell, with the feedback getting progressively more... poignant! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts