'使用VBA建立一文字檔
Private Sub CommandButton2_Click()
Dim otfile As String
otfile = "d:\test.csv"
Open otfile For Output As #1
'寫出資料
Print #1, "第一行"
Close #1
MsgBox("完成")
End Sub
'使用VBA讀取一文字檔
Sub in1()
Dim infile As String
Dim str1 As String
infile = "d:\test.csv"
Open infile For Input As #1
Do While Not EOF(1)
Line Input #1, str1
Loop
MsgBox(str1)
Close #1
End Sub
全站熱搜