set the cancelerror property to true. then catch the error.
You can also set the cancelerror in design viewCode:Private Sub mnuFileSaveAs_Click() on local error goto errhandler commondialog1.cancelerror = true CommonDialog1.Filter = "Text (*.txt)|*.txt|" 'You can add other File Names here CommonDialog1.ShowSave Open CommonDialog1.Filename For Output As #1 Print #1, Text1.Text Close #1 errhandler: 'catch cancel error here End Sub




Reply With Quote