Wayne, I took your Sleep Sub and ran with it. Oh yeaaaaaaaaaa! I added a few required things like the Print text1 and defined text1 as a String. When I got it to run I was surprised to see that the print out printed 1, 12, 123, 1234, and so on. It was not exactly what I wanted but I found it interesting. I'm sure I'll find a use for that output format in another project someday. Anyway, I messed with the code a bit more and ended up with the code below. Thank you sooooo much for your time and skill. It works great!! '_____________________________________________________________________________ 'Some of this code provided by Wayne Spangler of a1vbcode.com. He specificaly supplied 'the Private Sub Sleep block which is the heart of the timing sequence. '_________________________________________________________________________________________
Option Explicit Dim Display As String Dim Prompt As String Dim Counter As Integer Dim Check As Boolean Private Sub Command1_Click() Do ' Outer loop. Do While Counter < 20 ' Inner loop. Counter = Counter + 1 ' Increment Counter. Sleep 1 ' Wait 1 second between each print statement. Display = Prompt & Counter ' Print each count Print Display If Counter = 10 Then ' If condition is True. Check = False ' Set value of flag to False. Exit Do ' Exit inner loop. End If Loop Loop Until Check = False ' Exit outer loop immediately. End Sub 'add a delay time to the current time and waits for the current 'time to catch up. Private Sub Sleep(ByVal delay As Single) Dim x As Single x = Timer + delay Do While x > Timer DoEvents Loop End Sub Private Sub Form_Load() Show Prompt = "Count " 'Prefix Print Statement with Count. End Sub
________________________________________________________________ "So much to learn. So little time to do it. Wise men know it's later than one thinks"! Mark's Syntax.Zip Pause Sub I don't answer programming questions via PMs. That's what the forum is for!
|