I'm using the standard Message box. Here is the code I have.
Public Sub Timestamp()
'Init
Dim time As String
Dim Hours As String
Dim Min As String
Dim AMPM As String
Dim TestPeriod As String
time = ""
AMPM = "AM"
Title = "Enter the time"
Message = "Example, 1:30 AM = 1.30.0, 4:56 PM = 4.56.1 Click OK to exit."
Default0 = 0
time = InputBox(Message, Title, Default0)
If time = "0" Then GoTo Exitloop
TestPeriod = Mid(time, 2, 1)
'Tests for double digits
If TestPeriod <> "." Then
Hours = Left(time, 2)
Min = Mid(time, 4, 2)
If Hours = "12" Then AMPM = "PM"
GoTo Finish
End If
'For the rest of the times
Hours = Left(time, 1)
Min = Mid(time, 3, 2)
If Right(time, 1) = "1" Then AMPM = "PM"
GoTo Finish
Finish:
Selection.Value = Hours & ":" & Min & " " & AMPM
ActiveCell.Offset(1, 0).Select
Call Timestamp
Exitloop:
End Sub
Here is the code for it. The problem is when I click on cancel, it runs Finish. I've tried adding an If statment at the begining of finish, but the program ignores it.
I'm the only one that uses it, so I'm not worried about it being pretty or foul proof. But I do click on cancel every now and again instead of hitting the enter key, or clicking on OK.