Sub MOpenLog_Click () Dim replace On Error Resume Next '--- Get Log File name from the user OpenLog.DialogTitle = "Open Communications Log File" OpenLog.Filter = "Log Files (*.LOG)|*.log|All Files (*.*)|*.*" Do OpenLog.Filename = "" OpenLog.Action = 1 If Err = CDERR_CANCEL Then Exit Sub Temp$ = OpenLog.Filename '--- If file already exists, do they want to ' overwrite or add to it. Ret = Len(Dir$(Temp$)) If Err Then MsgBox Error$, 48 Exit Sub End If If Ret Then replace = MsgBox("Replace existing file - " + Temp$ + "?", 35) Else replace = 0 End If Loop While replace = 2 '--- User picked "Yes" button - Delete file. If replace = 6 Then Kill Temp$ If Err Then MsgBox Error$, 48 Exit Sub End If End If '--- Open the log file hLogFile = FreeFile Open Temp$ For Binary Access Write As hLogFile If Err Then MsgBox Error$, 48 Close hLogFile hLogFile = 0 Exit Sub Else '--- Seek to the end so we append new data Seek hLogFile, LOF(hLogFile) + 1 End If Form1.Caption = "MSComm Terminal - " + OpenLog.Filetitle MOpenLog.Enabled = False MCloseLog.Enabled = True End Sub