Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
kimla10 kimla10 is offline
external usenet poster
 
Posts: 2
Default calculating hours/time

How do i calculate time ; hours worked ? I am trying to find a field code
formula in a Word table and then to minus that by 0.30? I have designed a
Timesheet but want to calculate daily hours then minus it by lunch break.
Can anyone help?

I have seen time calculations but i can't find time as in hours worked.
  #2   Report Post  
Posted to microsoft.public.word.tables
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default calculating hours/time

Hi kimla10,

Although it can be done in Word, Excel is a far better tool for this. And, in Word, a macro is probably going to give you a better
solution than a field code. Here's some code recently posted recently by Jay Freedman, another Microsoft Word MVP:

Sub demo()
Dim startTime As Date, endTime As Date
Dim diffHr As Long, diffMin As Long
startTime = CDate("8:00 am")
endTime = CDate("12:35 pm")
diffMin = Abs(DateDiff("n", startTime, endTime))
diffHr = Int(diffMin / 60) ' truncated to whole hours
diffMin = diffMin Mod 60 ' remaining minutes
MsgBox diffHr & ":" & diffMin
End Sub

To make this work in your table, you'd need to get the startTime & endTime from formfields with their properties set to run the
macro on exit, then output the result to another field instead of to the message box.

Having said all the above, if you *really* want to go down the field code route, you can how to do this and just about everything
else you might want to do with dates in Word, check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"kimla10" wrote in message ...
How do i calculate time ; hours worked ? I am trying to find a field code
formula in a Word table and then to minus that by 0.30? I have designed a
Timesheet but want to calculate daily hours then minus it by lunch break.
Can anyone help?

I have seen time calculations but i can't find time as in hours worked.


  #3   Report Post  
Posted to microsoft.public.word.tables
Henk57[_106_] Henk57[_106_] is offline
external usenet poster
 
Posts: 1
Default calculating hours/time


Excel is better equipped for this. If you want it in Word, eg if you
need to make a weekly report, you can link the Excel table to the word
document so it automatically updates in Word once changed in Excel.

macropod;2433439 Wrote:
Hi kimla10,

Although it can be done in Word, Excel is a far better tool for this.
And, in Word, a macro is probably going to give you a better
solution than a field code. Here's some code recently posted recently
by Jay Freedman, another Microsoft Word MVP:

Sub demo()
Dim startTime As Date, endTime As Date
Dim diffHr As Long, diffMin As Long
startTime = CDate("8:00 am")
endTime = CDate("12:35 pm")
diffMin = Abs(DateDiff("n", startTime, endTime))
diffHr = Int(diffMin / 60) ' truncated to whole hours
diffMin = diffMin Mod 60 ' remaining minutes
MsgBox diffHr & ":" & diffMin
End Sub

To make this work in your table, you'd need to get the startTime &
endTime from formfields with their properties set to run the
macro on exit, then output the result to another field instead of to
the message box.

Having said all the above, if you *really* want to go down the field
code route, you can how to do this and just about everything
else you might want to do with dates in Word, check out my Date Calc
'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"kimla10" wrote in message
...-
How do i calculate time ; hours worked ? I am trying to find a field
code
formula in a Word table and then to minus that by 0.30? I have
designed a
Timesheet but want to calculate daily hours then minus it by lunch
break.
Can anyone help?

I have seen time calculations but i can't find time as in hours
worked. -





--
Henk57
  #4   Report Post  
Posted to microsoft.public.word.tables
kimla10 kimla10 is offline
external usenet poster
 
Posts: 2
Default calculating hours/time

Thanks very very much. I did think that it was better in Excel but i didn't
know i could link the two. Thanks a bunch. I am very grateful for the info.
Kimla10

"Henk57" wrote:


Excel is better equipped for this. If you want it in Word, eg if you
need to make a weekly report, you can link the Excel table to the word
document so it automatically updates in Word once changed in Excel.

macropod;2433439 Wrote:
Hi kimla10,

Although it can be done in Word, Excel is a far better tool for this.
And, in Word, a macro is probably going to give you a better
solution than a field code. Here's some code recently posted recently
by Jay Freedman, another Microsoft Word MVP:

Sub demo()
Dim startTime As Date, endTime As Date
Dim diffHr As Long, diffMin As Long
startTime = CDate("8:00 am")
endTime = CDate("12:35 pm")
diffMin = Abs(DateDiff("n", startTime, endTime))
diffHr = Int(diffMin / 60) ' truncated to whole hours
diffMin = diffMin Mod 60 ' remaining minutes
MsgBox diffHr & ":" & diffMin
End Sub

To make this work in your table, you'd need to get the startTime &
endTime from formfields with their properties set to run the
macro on exit, then output the result to another field instead of to
the message box.

Having said all the above, if you *really* want to go down the field
code route, you can how to do this and just about everything
else you might want to do with dates in Word, check out my Date Calc
'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"kimla10" wrote in message
...-
How do i calculate time ; hours worked ? I am trying to find a field
code
formula in a Word table and then to minus that by 0.30? I have
designed a
Timesheet but want to calculate daily hours then minus it by lunch
break.
Can anyone help?

I have seen time calculations but i can't find time as in hours
worked. -





--
Henk57

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you recover an unsaved document 24 hours later? JMB Microsoft Word Help 1 February 14th 07 03:41 PM
Working with formulas in Word tables - calculating time on scene. HCFRAdmin Tables 6 January 21st 06 05:28 AM
convert time to hours in Word table kathleen Tables 2 August 27th 05 12:17 AM
Word practically shuts down after 10 hours Alaska Microsoft Word Help 2 July 20th 05 04:54 PM


All times are GMT +1. The time now is 01:25 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"