引入控件commondialog,然后如下:On Error Resume Next
CommonDialog1.Filter = "文本文档(*.txt)|*.txt"
CommonDialog1.ShowSave
RichTextBox1.SaveFile CommonDialog1.FileName, rtfText
If Err = cdlCancel Then
End If
CommonDialog1.Filter = "文本文档(*.txt)|*.txt"
CommonDialog1.ShowSave
RichTextBox1.SaveFile CommonDialog1.FileName, rtfText
If Err = cdlCancel Then
End If
RichTextBox1.SaveFile filename,1( filename的后缀名是.txt的)
这样就行了.
要不就象楼上说的那样,那样比较麻烦.
object 必需的。对象表达式,其值是“应用于”列表中的一个对象。
pathname 必需的。字符串表达式,它定义保存控件内容文件的路径和文件名。
filetype 可选的。整数或常数,按照“设置值”中的描述确定加载文件的类型。 设置值filetype 的设置值是:常数 值 描述
rtfRTF 0 (缺省)RTF。RichTextBox 控件把它的内容存为一个 .rtf 文件。
rtfText 1 文本。RichTextBox 控件把它的内容存为一个文本文件。
说明也可用 Visual Basic 的 Write 函数和 RichTextBox 控件的 TextRTF 属性和 SelRTF 属性写 .rtf 文件。例如,可按如下方式把 RichTextBox 控件中突出显示的内容存为 .rtf 文件。Open "mytext.rtf" For Output As 1Print #1, RichTextBox1.SelRTFhttp://www.xygu.com