Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.tables
|
|||
|
|||
![]()
I would like to create a form to use for recording an ongoing series of
events. The form would have a check box that when checked would display current time (start of event). Another check box when checked would also display the current time (end of event). Finally the elapsed time (difference between start and end of event would be displayed. Thanx |
#2
![]()
Posted to microsoft.public.word.tables
|
|||
|
|||
![]()
I would create a userform with two checkboxes chkStart and chkEnd, three
textboxes txtStart, txtEnd and txtElapsed and a command button cmdClear Then use the following code in the UserForm: Private Sub chkEnd_Click() Dim Hours As Long, Minutes As Long, Seconds As Long, Elapsed As Long txtEnd.Text = Format(Now, "HH:mm:ss") If chkEnd.Value = True Then Elapsed = DateDiff("s", txtStart, txtEnd) Else Exit Sub End If Hours = Int(Elapsed / 3600) Minutes = Int((Elapsed Mod 3600) / 60) Seconds = Elapsed Mod 60 txtElapsed.Text = Format(Hours, "00") & ":" & Format(Minutes, "00") & ":" & Format(Seconds, "00") End Sub Private Sub chkStart_Click() txtStart.Text = Format(Now, "HH:mm:ss") End Sub Private Sub cmdClear_Click() chkStart.Value = False txtStart.Text = "" chkEnd.Value = False txtEnd.Text = "" txtElapsed.Text = "" End Sub When you check the chkStart checkbox, the start time will be displayed in the txtStart textbox as HH:mm:ss and when the chkEnd checkbox is checked, the txtEnd textbox will display the finish time as HH:mm:ss and the txtElapsed textbox will display the elapese time, also in HH:mm:ss format. The cmdClear button will remove all data from the form so that the process can be repeated. If you don't know how to create a userform, see the necessary parts of the article "How to create a Userform" at: http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "JFR" wrote in message ... I would like to create a form to use for recording an ongoing series of events. The form would have a check box that when checked would display current time (start of event). Another check box when checked would also display the current time (end of event). Finally the elapsed time (difference between start and end of event would be displayed. Thanx |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I check the spelling in only one of multiple form fields? | Microsoft Word Help | |||
Can I change the check style for the check box form field in '03? | Microsoft Word Help | |||
To create a form | New Users | |||
How do I create a document with a check list but that others can . | Microsoft Word Help | |||
date and time check button problem | Tables |