Question
Open a new workbook in Excel, get into the VBE, and insert a module into this new workbook. Type the following code in the Code
Open a new workbook in Excel, get into the VBE, and insert a module into this new workbook. Type the following code in the Code window. Make sure there is no Option Explicit line at the top of the code window. (If there is one, delete it.)
Sub EnterUserNameSlowly( )
Range("A1").Value = "The user of this copy is Excel is listed below."
yourName = Application.UserName
nChars = Len(yourName)
For i = 1 To nChars
Range("A3").Value = Left(yourName, i)
newHour = Hour(Now( ))
newMinute = Minute(Now( ))
newSecond = Second(Now( )) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait
waitTime
Next
End Sub
Next, return to Sheet1 of this workbook, add a button and assign the EnterUserNameSlowly sub to it, and then run the program by clicking the button. Can you now explain what the code is doing? (If you like, look up the Wait method of the Application object in the Object Browser for online help.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started