2014-01-14 225 views
1

我必须创建一个txt文件,以便在VB6中创建一些大型内容。任何人都可以帮我解决这个问题,请告诉我参考。如何创建txt文件

回答

11

这是如何在VB6

创建一个文本文件

Source

16

有多大?

保持简单:

'1 form with: 
' 1 textbox: name=Text1 
' 1 command button: name=Command1 
Option Explicit 

Private Sub Command1_Click() 
    Dim intFile As Integer 
    Dim strFile As String 
    strFile = "c:\temp\file.txt" 'the file you want to save to 
    intFile = FreeFile 
    Open strFile For Output As #intFile 
    Print #intFile, Text1.Text 'the data you want to save 
    Close #intFile 
End Sub 

这将您单击命令按钮,每次替换该文件,如果你想添加到文件,那么你可以打开“进行追加”,而不是“输出“

reference

+1

谢谢先生,你只是让我的一天.. – XMozart