vb问题,vb高手请进 高分悬赏!!!
下面的保存的代码运行的时候可以弹出“保存”对话框,但是没有文件生成???????急急急急急急急急急急急!代码:PrivateSubsave_Click()OnErrorG...
下面的保存的代码运行的时候可以弹出“保存”对话框,但是没有文件生成???
????急急急急急急急急急急急!
代码:
Private Sub save_Click()
On Error GoTo error2
Dim file As String
If Left$(ActiveForm.Caption, 5) = "未命名文档" Then
With CD
.DialogTitle = "保存"
.CancelError = True
.Flags = 2
.Filter = "写字板文件(*.rtf)|*.rtf|所有文件(*.*)|*.*"
.FileName = ActiveForm.Caption
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
Else
file = .FileName
End If
End With
Else
file = ActiveForm.Caption
End If
If Right$(file, 4) = ".txt" Then
ActiveForm.RichTextBox1.SaveFile , 1
ActiveForm.Caption = file
Else
ActiveForm.RichTextBox1.SaveFile , 0
ActiveForm.Caption = file
End If
error2:
If Err.Number = cdlCancel Then Exit Sub
End Sub 展开
????急急急急急急急急急急急!
代码:
Private Sub save_Click()
On Error GoTo error2
Dim file As String
If Left$(ActiveForm.Caption, 5) = "未命名文档" Then
With CD
.DialogTitle = "保存"
.CancelError = True
.Flags = 2
.Filter = "写字板文件(*.rtf)|*.rtf|所有文件(*.*)|*.*"
.FileName = ActiveForm.Caption
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
Else
file = .FileName
End If
End With
Else
file = ActiveForm.Caption
End If
If Right$(file, 4) = ".txt" Then
ActiveForm.RichTextBox1.SaveFile , 1
ActiveForm.Caption = file
Else
ActiveForm.RichTextBox1.SaveFile , 0
ActiveForm.Caption = file
End If
error2:
If Err.Number = cdlCancel Then Exit Sub
End Sub 展开
1个回答
展开全部
If Right$(file, 4) = ".txt" Then
ActiveForm.RichTextBox1.SaveFile , 1
ActiveForm.Caption = file
Else
ActiveForm.RichTextBox1.SaveFile , 0
ActiveForm.Caption = file
End If
改为
If Right$(file, 4) = ".txt" Then
ActiveForm.RichTextBox1.SaveFile file , 1
ActiveForm.Caption = file
Else
ActiveForm.RichTextBox1.SaveFile file , 0
ActiveForm.Caption = file
End If
ActiveForm.RichTextBox1.SaveFile , 1
ActiveForm.Caption = file
Else
ActiveForm.RichTextBox1.SaveFile , 0
ActiveForm.Caption = file
End If
改为
If Right$(file, 4) = ".txt" Then
ActiveForm.RichTextBox1.SaveFile file , 1
ActiveForm.Caption = file
Else
ActiveForm.RichTextBox1.SaveFile file , 0
ActiveForm.Caption = file
End If
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询