|
我用VBA的代码如下,将TXT文档处理后赋值到一个二维数组orr
sub test()
FileName = Application.GetOpenFilename("txt,*.txt", , "select", , False)
Open FileName For Input As #1
aa = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
Close #1
ReDim orr(1 To UBound(aa), 1 To 20)
m = 0
For i = 5 To UBound(aa)
If Len(Trim(aa(i))) < 50 Then GoTo L1
If InStr(aa(i), "-------") > 0 Then GoTo L1
If InStr(aa(i), "Custname") > 0 Then GoTo L1
m = m + 1
n = 1: orr(m, n) = Trim(Left(aa(i), 45))
n = 2: orr(m, n) = Trim(Mid(aa(i), 46, 26))
n = 3: orr(m, n) = Trim(Mid(aa(i), 73, 26))
n = 4: orr(m, n) = Trim(Mid(aa(i), 100, 38))
n = 5: orr(m, n) = Trim(Mid(aa(i), 139, 25))
n = 0
L1: Next
end sub
现在想把orr内的数据赋值到Access里建好的”表1“里去。请问代码应该怎么写呢?
谢谢
|
|