(求助)记事本的新建
Private Sub NewFile_Click()Dim FileName$
If RtxtContent.Text = "" Then
RtxtContent.Text = ""
FileName = "无标题 - 记事本"
Me.Caption = FileName
ElseIf RtxtContent.Text <> "" Then
i = MsgBox("文件 " & Me.Caption & " 的文字已经改变。想保存文件吗?", 3 + 48 + 0, 记事本)
If i = vbYes Then
On Error GoTo Errhandler
CommonDialog1.FileName = "*.txt"
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|所有文件|*.*"
CommonDialog1.FilterIndex = 1
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
Open CommonDialog1.FileName For Output As #1
Print #1, RtxtContent.Text
Close #1
RtxtContent.Text = ""
End If
Errhandler:
Exit Sub
ElseIf i = vbNo Then
Close
RtxtContent.Text = ""
End If
End If
End Sub
谁能帮我改改错?
就是我弹出保存对话框后,如果我要保存的文件名是已有文件名,会再弹出提示是否覆盖(这里我做不出了,谁能帮我完成?谢谢了。我写得有些复杂。)。