提取txt文件中特定内容后的数据到excel
1个回答
展开全部
Sub AAA()
Dim Ar(1 To 10000, 1 To 1)
Dim N As Long
Dim L As Long
Dim S As String
Open "D:\123.TXT" For Binary As #1
S = StrConv(InputB(LOF(1), 1), vbUnicode)
Close #1
S = Replace(S, Chr(9), "")
S = Replace(S, Chr(0), "")
L = InStr(1, S, "energy=", vbTextCompare)
Do Until L = 0
N = N + 1
L = L + 8
Ar(N, 1) = "'" & Trim(Mid(S, L, InStr(L + 2, S, " ") - L))
L = InStr(L, S, "energy=", vbTextCompare)
Loop
[A1].Resize(N) = Ar
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |