Private Sub Command1_Click()
Text1.Text = "15:12:10"
Text2.Text = "00:10:00"
Label1.Caption = SOMAHORAS(Text1, Text2)
End Sub
Function SOMAHORAS(HORA1 As Date, HORA2 As Date) As Date
Dim HORATEMP1, HORATEMP2, XHORA1, XHORA2, XHORAS, XMIN1, XMIN2, XMINS, XSEG1, XSEG2, XSEGS As String
HORATEMP1 = "00:00:00"
HORATEMP2 = "00:00:00"
XHORA1 = Mid(HORA1, 1, 2)
XHORA2 = Mid(HORA2, 1, 2)
XHORAS = Val(XHORA1) + Val(XHORA2)
'Label1.Caption = DateAdd("h", XHORAS, HORA2)
XMIN1 = Mid(HORA1, 4, 2)
XMIN2 = Mid(HORA2, 4, 2)
XMINS = Val(XMIN1) + Val(XMIN2)
XSEG1 = Mid(HORA1, 7, 2)
XSEG2 = Mid(HORA2, 7, 2)
XSEGS = Val(XSEG1) + Val(XSEG2)
HORATEMP2 = DateAdd("h", XHORAS, HORATEMP1)
HORATEMP1 = HORATEMP2
HORATEMP2 = DateAdd("n", XMINS, HORATEMP1)
HORATEMP1 = HORATEMP2
HORATEMP2 = DateAdd("s", XSEGS, HORATEMP1)
HORATEMP1 = HORATEMP2
SOMAHORAS = Format(HORATEMP1, "hh:nn:ss")
End Function
Comendador enviou este.