Timer for Workbook

Akashwani

Well-known Member
Joined
Mar 14, 2009
Messages
2,911
Hi,

I have spent the last 3 hours searching/researching this and I have drawn a blank, so I'm back here for HELP.

I would like a "timer" to calculate, from the Workbook being opened to it being closed.

I would like a message to appear saying...
"You have been active for ??? minutes"

Is this a possibility?

Ak
 
Yeah, problem solved,
and I solved it:ROFLMAO:

I deleted End Sub and Sub TrialQuestions()

Thanks anyway

Ak



Dim t As Date
Private Sub Workbook_Open()
Dim s As String
MsgBox ("WELCOME")
s = InputBox("Enter your first name")
t = Now
Const strRightAnswer As String = "Ottawa"
Dim strAnswer As String
While Not (strRightAnswer = strAnswer)
strAnswer = InputBox("What is the Capital of Canada?")
If Not (strRightAnswer = strAnswer) Then MsgBox "Incorrect answer please try again."
Wend
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox "You have been active for " & Format(Now - t, "nn") & " minutes and " & Format(Now - t, "ss") & " seconds."
Dim res
res = MsgBox(" Do you like chocolate?", vbYesNo)
If res <> vbYes Then Cancel = True
End Sub
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,215,222
Messages
6,123,704
Members
449,118
Latest member
MichealRed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top