Private Sub sendbutton_Click()
Dim chattext As String
Dim retry_flag As Boolean
Dim ErrNo As Integer
User = Application.UserName
If chatbox.Value <> "" Then
chattext = "[" & User & "]: " & chatbox.Valuechatbox.Value = ""
retry:
On Error Resume Next
Open "C:\chat.csv" For Output As #1
Print #1, chattext; Tab; Format(Now(), ", hh:mm:ss")
Close #1ErrNo = ErrOn Error GoTo 0
If ErrNo <> 0 And retry_flag <> True Then
retry_flag = True
Application.Wait Now + TimeValue("00:00:01")
GoTo retry
End If
End If
chatbox.SetFocus
End Sub