Private Sub Form_Unload(Cancel As Integer) If msComm1.PortOpen Then msComm1.PortOpen = False End If