Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.tables
|
|||
|
|||
![]()
Word is definitely not the best tool for the job. However, using the Legacy
FormFields available in the Controls section of the Developer tab, and a macro containing the following code run on exit from the formfield into which the finish time is entered, the duration between the start and the finish times will be calculated and appear in the Duration formfield. ' a Macro to calculate the elapsed time for formfields with Date format of HH:mm ' Macro created 16 May 1999 by Doug Robbins - Word MVP ' Dim Start as String, Finish as String Dim StartHour as Long, StartMinutes as Long, StartTimeMinutes as Long Dim FinishHour as Long, FinishMinutes as Long FinishTimeMinutes as Long Dim Elapsed Minutes as Long, Elapsed Hours as Long Start = ActiveDocument.FormFields("Start").Result StartHour = Val(Left(Start, 2)) StartMinutes = Val(Right(Start, 2)) StartTimeMinutes = StartHour * 60 + StartMinutes Finish = ActiveDocument.FormFields("Finish").Result FinishHour = Val(Left(Finish, 2)) FinishMinutes = Val(Right(Finish, 2)) FinishTimeMinutes = FinishHour * 60 + FinishMinutes ElapsedMinutes = FinishTimeMinutes - StartTimeMinutes ElapsedHours = Int(ElapsedMinutes / 60) ElapsedMinutes = ElapsedMinutes - ElapsedHours * 60 ActiveDocument.FormFields("Duration").Result = Str(ElapsedHours) & ":" & Format(ElapsedMinutes, "00") If I were creating a timesheet system that made use of Microsoft Office, I would develop it in Access. Excel would be the next choice of application and Word would be the last. -- 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 "KB-1" wrote in message ... Is it possible to make a time sheet in Word 2007 where each cell of a table can be formatted to be based off the 12hr clock and total up the daily and weekly hours?? I am not familiar with Word at all. |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format Date and Time to show Military Time | Microsoft Word Help | |||
Please Help me in Style Sheets | Microsoft Word Help | |||
Style Sheets | Microsoft Word Help | |||
Changing time on all sheets | Microsoft Word Help | |||
New Blank sheets | New Users |