- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
回復 1# luke - Sub 匯入()
- Dim ary() As String, rw As Long, Mystr$, MyPath$
- rw = 2: i = 0
- path1 = "D:\TEST\"
- file1 = Dir(path1 & "*.*", vbDirectory) '只處理資料夾
- Do While file1 <> ""
- If file1 <> "." And file1 <> ".." And _
- GetAttr(path1 & file1) = vbDirectory Then
- i = i + 1
- ReDim Preserve ary(i)
- ary(i) = file1
- End If
- file1 = Dir
- Loop
- For i = 1 To UBound(ary)
- Cells(rw, 1) = ary(i)
- MyPath = path1 & ary(i) & "\"
- fs = Dir(MyPath & "*.ccc")
- Open MyPath & fs For Input As #1
- Line Input #1, Mystr
- Cells(rw, 7) = Mid(Mystr, 2)
- Close #1
- rw = rw + 1
- Next i
- End Sub
複製代碼 |
|