vba 读取txt文件的第8行内容怎么写?
关键是第八行,我自己找了个函数,看不出哪个是关于行的谁告诉我怎么弄呢?PrivateSubCommandButton1_Click()Dimfilename,inputs...
关键是第八行,我自己找了个函数,看不出哪个是关于行的
谁告诉我怎么弄呢?
Private Sub CommandButton1_Click()
Dim filename, inputstring As String
Dim i As Integer
Dim data
i = 1
filename = "d:\WYKS.txt" '本列TXT文件放在D盘中
Open filename For Input Access Read As #1
Do While Not EOF(1)
Line Input #1, inputstring '读TXT文件一行
data = inputstring
If i <> 1 Then
.........
End If
i = i + 1
Loop
Close #1
End Sub 展开
谁告诉我怎么弄呢?
Private Sub CommandButton1_Click()
Dim filename, inputstring As String
Dim i As Integer
Dim data
i = 1
filename = "d:\WYKS.txt" '本列TXT文件放在D盘中
Open filename For Input Access Read As #1
Do While Not EOF(1)
Line Input #1, inputstring '读TXT文件一行
data = inputstring
If i <> 1 Then
.........
End If
i = i + 1
Loop
Close #1
End Sub 展开
1个回答
展开全部
Private Sub CommandButton1_Click()
Dim filename, inputstring As String
Dim i As Integer
Dim data
i = 1
filename = "d:\WYKS.txt" '本列TXT文件放在D盘中
Open filename For Input Access Read As #1
Do While Not EOF(1)
Line Input #1, inputstring '读TXT文件一行
data = inputstring
If i =8 Then
msgbox("第八行数据是" & data)
End If
i = i + 1
Loop
Close #1
End Sub
追问
这个函数不用 DO while 用 for i=......行吗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询