Private Sub Command6_Click(Index As Integer)
'导入BOM+CSV(GC)
Dim i, n, c, ar, arr, br(1 To 1000, 1 To 2), brr, crr(1 To 10000, 1 To 6), fileDlg As Object, p, q, d As Object
Dim xlExcel As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim AppExcel As Object
Set d = CreateObject("scripting.dictionary")
Set xlExcel = CreateObject("Excel.Application")
Set fileDlg = CreateObject(")
' 打开附件
p = Text3.Item(0)
'位号符
q = Text4.Item(1)
'分割符
t = "0123456789"
fileDlg.DialogTitle = "选择BOM文件"
'先选择BOM文件
fileDlg.Filter = "Excel (*.xlsx;*.xls)|*.xlsx;*.xls|"
fileDlg.FilterIndex = 2
fileDlg.ShowOpen
If fileDlg.FileName <> "" Then
xlExcel.Workbooks.Open fileDlg.FileName
nm = Split(fileDlg.FileName, "\")(UBound(Split(fileDlg.FileName, "\")))
Set xlBook = xlExcel.Workbooks(nm)
Set xlSheet = xlBook.Worksheets(1)
ar = xlSheet.UsedRange
For i = 2 To UBound(ar)
If ar(i, Form1.Text2.Item(1)) <> "" Then
X = ar(i, Form1.Text1.Item(0))
k = Split(ar(i, Form1.Text2.Item(1)), p)
For j = 0 To UBound(k)
If InStr(k(j), q) Then
se = Split(k(j), q)
For m = Len(se(0)) To 1 Step -1
If InStr(t, Mid(se(1), m, 1)) = 0 Then Exit For
Next
s = Val(Mid(se(0), m + 1))
Y = Replace(se(0), s, "")
For m = Len(se(1)) To 1 Step -1
If InStr(t, Mid(se(1), m, 1)) = 0 Then Exit For
Next
e = Val(Mid(se(1), m + 1))
For m = s To e
n = n + 1
br(n, 1) = X
br(n, 2) = Y & m
Next
Else
n = n + 1
br(n, 1) = X
br(n, 2) = k(j)
End If
Next
End If
Next
Else
rtnResult = True
Exit Sub
End If