The best line of VBA ever

Posted on May 5th, 2008 in Excel,General,Office 2007 by Ken Puls

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:
  1. Application.Speech.Speak Target

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

CODE:
  1. Sub Count()
  2. Dim lCount As Long
  3.  
  4. For lCount = 1 To 100
  5. With ActiveCell
  6. .Value = lCount
  7. .Offset(1, 0).Select
  8. End With
  9. Next lCount
  10. End Sub

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 Responses to 'The best line of VBA ever'

Subscribe to comments with RSS or TrackBack to 'The best line of VBA ever'.

  1. Ross said,

    on May 7th, 2008 at 1:42 am

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

  2. Ken Puls said,

    on May 7th, 2008 at 6:58 am

    Hi Ross,

    They removed it from the UI in Excel 2007. Don't ask me why...

    I built an add-in last night to bring it back for a user.


  3. on May 8th, 2008 at 8:37 am

    Ken,

    Enjoy the time the young lady sees You as her hero and not as a dinosauire (with a 'fat' wallet) ;-)

    Kind regards,
    Dennis

  4. Ross said,

    on May 9th, 2008 at 1:04 am

    oock!
    God bless 2007!

  5. Danny said,

    on June 13th, 2008 at 6:33 am

    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"

  6. Ken Puls said,

    on June 13th, 2008 at 8:39 am

    LOL! That's beautiful!

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

Post a comment