Computer Learning Zone CLZ Access Excel Word Windows

Life is not fair. Get used to it.

-Bill Gates
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > General
Back to General Discussion Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email  
I Got Bored
Fred Stetson 
    
7 months ago
...and created this little fun VBA code.   Simply create a Command Button (btnStartConversation) and a Text Field (txtConversation).  Plug in this code to the button and have a laugh.

DetailsOption Compare Database
Option Explicit

'This code is brought to you by Fred Stetson, of Stetson Management Solutions
'You may use this code as long as you keep this statement intact.

Private Sub btnStartConversation_Click()
Me.Refresh
    Dim conversation As Variant
    Dim i As Integer
    Dim conversationText As String
    
    ' Define the conversation lines in an array
    conversation = Array( _
        "Abbott: Who's on first?", _
        "Costello: What?", _
        "Abbott: Who's on first?", _
        "Costello: What? The guy's name?", _
        "Abbott: No, Who's on first!", _
        "Costello: I'm asking you, what's the guy's name?", _
        "Abbott: That's the man's name.", _
        "Costello: Who?", _
        "Abbott: Yes, that's right.", _
        "Costello: Who's right?", _
        "Abbott: Yes.", _
        "Costello: So, the guy's name is 'Yes'?", _
        "Abbott: No, the guy's name is 'Who'.", _
        "Costello: Who's on first?", _
        "Abbott: What?", _
        "Costello: What is the guy's name?", _
        "Abbott: No, the guy's name is 'Who'.", _
        "Costello: That's what I'm asking!", _
        "Abbott: No, you're asking, 'What?' That's what I'm trying to tell you. The guy's name is 'Who'." _
    )
    
    ' Clear the text box
    Me.txtConversation.Value = ""
    
    ' Loop through the conversation array and display each part with a pause
    For i = LBound(conversation) To UBound(conversation)
        conversationText = conversation(i)
        
        ' Add text to the textbox with a line break
        Me.txtConversation.Value = Me.txtConversation.Value & conversationText & vbCrLf
        
        ' Pause for a brief moment between lines
        DoEvents
        Pause (1.5) ' Pause for 1.5 seconds
    Next i

End Sub

' Simple Pause function to create delay
Private Sub Pause(seconds As Integer)
    Dim startTime As Double
    startTime = Timer
    Do While Timer < startTime + seconds
        DoEvents
    Loop
End Sub

Private Sub txtConversation_BeforeUpdate(Cancel As Integer)
Me.Refresh
End Sub
Fred Stetson OP  @Reply  
    
7 months ago

Richard Rost  @Reply  
          
7 months ago
I love it. :)
Fred Stetson OP  @Reply  
    
7 months ago
Imagine working at a desk all day processing data and some thing like this popped up on your screen when it was time to take a break!  &#128514;
Fred Stetson OP  @Reply  
    
7 months ago
The only thing I can't seem to fix is getting the the4 white flashing from causing eye fatigue.  Have to addressed this at all in your work?
Richard Rost  @Reply  
          
7 months ago
You could try turning off Echo. Here are some videos that address it: Echo
Fred Stetson OP  @Reply  
    
7 months ago
Sorry, but I am not proficient with how ECHO irks or how to embed in VBA.
Richard Rost  @Reply  
          
7 months ago
Well, that's why I gave you links for a couple of videos to teach you how to do it. 😁
Fred Stetson OP  @Reply  
    
6 months ago
got me again!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in General Discussion Forum.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/17/2025 10:46:03 AM. PLT: 1s