i have these two codes for save
first
VB Code:
  1. Private Sub Save_Click()
  2.  
  3.  CommonDialog1.Flags = cdlOFNOverwritePrompt
  4.     With CommonDialog1
  5.         .CancelError = True
  6.         .Filter = "Text files (*.txt)|*.txt"
  7.         .DialogTitle = "Save the file..."
  8.         CommonDialog1.Flags = cdlOFNOverwritePrompt
  9.         .ShowSave
  10.             If .filename <> "" Then
  11.                RichTextBox1.SaveFile .filename, rtfText
  12.                RichTextBox2.SaveFile Left(.filename, Len(.filename) - 4) & "first.txt", rtfText
  13.                
  14.             End If
  15.     End With
  16.        
  17.      
  18. End Sub


second
VB Code:
  1. Private Sub Command1_Click()
  2. With CommonDialog1
  3.         .CancelError = True
  4.         .Filter = "Text files (*.txt)|*.txt"
  5.         .DialogTitle = "Save the file..."
  6.         .ShowSave
  7.             If .filename <> "" Then
  8.               If fso.fileexists(Left(.filename, Len(.filename) - 4) & "first.txt") Then
  9.                 Form1.RichTextBox1.LoadFile .filename, rtfText
  10.                 RichTextBox2.LoadFile Left(.filename, Len(.filename) - 4) & "first.txt", rtfText
  11.                 txtFileText.Text = RichTextBox2.Text
  12.               Else
  13.                 MsgBox "This File is Not Tagged ,Please Select Another File!"
  14.                 Exit Sub
  15.               End If
  16.             End If
  17.     End With
  18.  
  19.  
  20. End Sub

i'm getting an error when i click Cancel how can i avoid this error without
using any msgbox , i just need to cancel saving without effecting the project