|
哪位大侠帮我看看一个问题,我现在可以读出txt了,可是就是不知道怎样把txt文本导入块属性,下面是我的代码:文本文件内有很多条:
如:;1;xxxxx;;管子%%c108*6;2;20G;22.6;45.2;;
;2;xxxxx;;管子%%c76*6;2;20G;15.5;31.0;;
;3;xxxxx;;管子%%c89*6;1;20G;;18.4;;
代码:
Private Sub CommandButton1_Click()
Me.Hide
Dim Filename1 As Variant
Dim str
Dim i As Integer
m = 0
With comDlg
.DialogTitle = "选择文本文件"
.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*"
'.InitDir = "C:\"
.ShowOpen
If .FileName = "" Then
Exit Sub
End If
Open .FileName For Input As #1
Do While Not EOF(1)
Line Input #1, str
Dim arr() As String
arr = Split(str, ";")
i = UBound(arr) - 2 + 1
For j = 1 To i - 1
Debug.Print arr(j)
这里应该是导入到块属性的代码,不知怎样去处理了,
Next j
m = m + 1
Loop
Close #1
End With
End Sub
谢谢 |
|