Thank you for the suggestion Sir Winon, I tried to do what you have said, and it was a success that I can close the userform without having a prompt of error, however, even if I can close the form, the clock still runs in the background, I wanted the clock to stop ticking when the userform was closed. can you suggest a code, I already tried the other codes inthe link given, but it only hides the form and does not stop the ticking of clock. I tried also the userform_queryclose, userform_deactivate but no avail.

Private Sub UserForm_Activate()
    Clock = Format(Now, "mm/dd/yyyy hh:mm:ss AMPM")
    m_lasttime = Now + TimeValue("00:00:01")
    Application.OnTime m_lasttime, "GetTime"
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode = 0 Then Cancel = True
theend:
End Sub

Private Sub UserForm_Deactivate()
    Clock = Format(Now, "mm/dd/yyyy hh:mm:ss AMPM")
    m_lasttime = Now + TimeValue("00:00:01")
    Application.OnTime m_lasttime, "GetTime"
End Sub