Reply
 
Thread Tools Display Modes
  #1   Report Post  
msmo
 
Posts: n/a
Default How do i calculate hours/minutes in a billing format.

I have a template that i downloaded... i need to calculate the hours table so
that it multiplies as hours and minutes...
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

This may give you an idea about how to go about it:

' a Macro to calculate the elapsed time for formfields with Date format of
HH:mm

'

Start = ActiveDocument.FormFields("Text1").Result

StartHour = Val(Left(Start, 2))

StartMinutes = Val(Right(Start, 2))

StartTimeMinutes = StartHour * 60 + StartMinutes

Finish = ActiveDocument.FormFields("Text2").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("Text3").Result = Str(ElapsedHours) & ":" &
Format(ElapsedMinutes, "00")


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"msmo" wrote in message
...
I have a template that i downloaded... i need to calculate the hours table
so
that it multiplies as hours and minutes...



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
Is there a template for a research paper in APA format? StanTheMan Microsoft Word Help 1 January 19th 05 02:35 AM
date format change when using serial printing Paulo Merieles Microsoft Word Help 3 January 5th 05 12:24 AM
In Word 2003, how to get rid of the 5x 7 in balloon format in the. steveb6 Page Layout 1 December 21st 04 05:45 AM
Maintaining the format of linked tables. James Tables 1 December 8th 04 01:30 PM
time format in comments on changes anfrage Microsoft Word Help 2 December 1st 04 10:09 AM


All times are GMT +1. The time now is 12:27 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"