[RESOLVED] problem in cancel save
i have these two codes for save
first
VB Code:
Private Sub Save_Click()
CommonDialog1.Flags = cdlOFNOverwritePrompt
With CommonDialog1
.CancelError = True
.Filter = "Text files (*.txt)|*.txt"
.DialogTitle = "Save the file..."
CommonDialog1.Flags = cdlOFNOverwritePrompt
.ShowSave
If .filename <> "" Then
RichTextBox1.SaveFile .filename, rtfText
RichTextBox2.SaveFile Left(.filename, Len(.filename) - 4) & "first.txt", rtfText
End If
End With
End Sub
second
VB Code:
Private Sub Command1_Click()
With CommonDialog1
.CancelError = True
.Filter = "Text files (*.txt)|*.txt"
.DialogTitle = "Save the file..."
.ShowSave
If .filename <> "" Then
If fso.fileexists(Left(.filename, Len(.filename) - 4) & "first.txt") Then
Form1.RichTextBox1.LoadFile .filename, rtfText
RichTextBox2.LoadFile Left(.filename, Len(.filename) - 4) & "first.txt", rtfText
txtFileText.Text = RichTextBox2.Text
Else
MsgBox "This File is Not Tagged ,Please Select Another File!"
Exit Sub
End If
End If
End With
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
Re: problem in cancel save
Here's the basic idea:
VB Code:
On Error GoTo eh
With CommonDialog1
.CancelError = True
'your code...
.ShowSave
End With
Exit Sub
eh:
If Err <> cdlCancel Then
MsgBox "Error #" & Err.Number & " - " & Err.Description
End If
Re: problem in cancel save
Re: [RESOLVED] problem in cancel save