VB中如何将text框中的内容进行保存?

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:32:29
一个text控件,一个按钮,text中已经有内容,点击按钮将text中内容保存到一个目录下,格式可以是.txt或word文档.

Private Sub Command1_Click()
open "C:\文件名.txt" for output as #1
print #1,text1.text
close #1
End Sub

fPath = App.Path & "\aaa.txt" '请根据你要保存的文件名及路径进行修改
Open fPath For Output as #1
Print #1,Text1.Text
Close #1