I’m having a problem calculating times using DateDiff. My project is an employee timesheet. For example, the user will enter the time they arrived in the morning and when they left for lunch. I need to calculate the difference between these two. Not a problem if they leave at noon, but if they arrive at 8:00 a.m. and leave at 1:00 p.m., I get a negative value. I know I’m omitting something necessary…perhaps a lot of things, since I’m pretty much a novice in this area.
Here’s what I wrote:
ActiveDocument.Variables.Add Name:=”MTotal”, Value:=Format(DateDiff(“h”, TB3, TB4), “HH:mm”)
I assume I would first have to determine if TB3 is am or pm; likewise for TB4.
Any assistance would be greatly appreciated.