Time sheets

K

KB-1

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.
 
D

Doug Robbins - Word MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top