VB6 写文件

时间:2023-03-09 17:05:59
VB6 写文件

Private Sub Form_Load()

Dim nHandle As Integer
Dim FilePath As String
FilePath = "c:\wgscd\17.txt"
On Error GoTo Err
nHandle = FreeFile(44)
Open FilePath For Output As #nHandle
Print #nHandle, "wgscd"
Print #nHandle, "------------"
Print #nHandle, "ffffffffffffffffffffffff"
Close #nHandle
Exit Sub
Err:
MsgBox "" & Err.Description

End Sub


OPEN语句
Open "文件完整名.txt" for output as #1
write #1 ,Temp '要写入的变量
close #1

Open "文件完整名.txt" for input as #1
input #1,Temp '要读入的变量
close #1