Private Sub cmdOutput_Click() '输出
Dim SavePath As String
CommonDialog1.ShowSave
SavePath = CommonDialog1.FileName
If Right(SavePath, 4) = ".txt" Or Right(SavePath, 4) = ".doc" Then
Open SavePath For Output As #2
print #2, txtContent.Text
Close #2 MsgBox "输出完成!", 64, "温馨提示"
Else: MsgBox "不支持的文件格式", 64, "温馨提示"
End If
End Sub
Private Sub Form_Load()
CommonDialog1.Filter = "文本文件 *.txt|*.txt|Word文档 *.doc|*.doc"
End Sub
Dim SavePath As String
CommonDialog1.ShowSave
SavePath = CommonDialog1.FileName
If Right(SavePath, 4) = ".txt" Or Right(SavePath, 4) = ".doc" Then
Open SavePath For Output As #2
print #2, txtContent.Text
Close #2 MsgBox "输出完成!", 64, "温馨提示"
Else: MsgBox "不支持的文件格式", 64, "温馨提示"
End If
End Sub
Private Sub Form_Load()
CommonDialog1.Filter = "文本文件 *.txt|*.txt|Word文档 *.doc|*.doc"
End Sub