第1个回答 2006-12-24
Private Sub Command1_Click()
cmd1.ShowSave 'cmd1是一个commondialog控件
If Not Len(cmd1.FileName) = 0 Then
Open cmd1.FileName For Output As 1 '打开一个你刚才输入的文件名,作为输出。
Print #1, Text1.Text '写数据
Close 1 '关闭
End If
End Sub
第2个回答 2019-06-10
哈哈,简单
CommonDialog1.Filter
=
"文本文档(*.txt)|*.txt|RTF文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
'CommonDialog1.ShowSave
FileType
=
CommonDialog1.FileTitle
FiType
=
LCase(Right(FileType,
3))
FileName
=
CommonDialog1.FileName
Select
Case
FiType
Case
"txt"
ActiveForm.RichTextBox1.SaveFile
FileName,
rtfText
Case
"rtf"
ActiveForm.RichTextBox1.SaveFile
FileName,
rtfRTF
Case
"*.*"
ActiveForm.RichTextBox1.SaveFile
FileName
End
Select
就是不显示
CommonDialog1.ShowSave
就可以了
第3个回答 2019-01-17
在窗体上画两个Text控件,Text1用来防止路径:Text2用来存储读出来的变量。
dim
Str
as
string
'打开
open
Text1.text
for
input
as
#1
do
while
not
(1)
line
input
#1,Str
Str=Str
&
Str
&
vbcrlf
loop
close
#1
text2.text=str
'保存
open
Text1.text
for
output
as
#2
print
#2,text2.text
close
#2
参考一下,看是否合你意.