Private Sub Save_As_Click()
VB Code:
With CommonDialog1 .InitDir = "C:" .FileName = "" .Filter = "Text File (*.txt)|*.txt" .DialogTitle = "Save file to:" .ShowSave on error goto CD_Error ' won't happen ever! Open .FileName For Output Lock Read As #1 Print #1, Text1.Text & vbNullChar Close #1 End With exit sub ' normal exit CD_Error: on error goto 0 ' reset error trap end with ' close with debug.print "Error in Save File!" End Sub ' error exit
You can also use ON ERROR RESUME NEXT, but those are the hardest to debug properly.




Reply With Quote