新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Command1_Click()
Dim hour As Long
Dim minute As Long
hour = GetTickCount \ 1000 \ 60 \ 60
Debug.Print Str(hour) + "小时"
minute = (GetTickCount - hour * 60 * 60 * 1000) \ 1000 \ 60
Debug.Print Str(minute) + "分钟"
End Sub
运行结果:
7小时
58分钟