VBA读写文件
Private Sub CommandButton1_Click()
Dim txt As String
Dim myString As String
Dim myNumber
txt = "C:\IDP-CI.Path"
Open txt For Output As #1 '...写文件
strData = "welcome,"
Print #1, strData, 123
Close #1
If Dir(txt) = "" Then
MsgBox "error"
Else
Open txt For Input As #2
Do While Not EOF(2) ' 循环至文件尾。
Input #2, myString, myNumber ' 将数据读入两个变量。
Loop
Close #2
MsgBox myString
End If
End Sub

被折叠的 条评论
为什么被折叠?



