- 帖子
- 10
- 主題
- 4
- 精華
- 0
- 積分
- 14
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- sp1
- 閱讀權限
- 10
- 註冊時間
- 2014-8-21
- 最後登錄
- 2016-4-17
|
[發問] getFolder如何取得到第二層資料夾
我想請問高手們,目前以下程式碼只能做到讀取一層資料夾的讀取而已,請問哪裡寫錯了嘛
我想要可以讀取我選擇好的目錄下所有的資料夾,可是不知道哪裡寫錯了
已經爬文許久,但始終無法找到答案,請高手們指點迷津,感恩- Set oexcel = CreateObject("Excel.Application")
- Dim objF As Object '定義開檔物件
- Dim strFoldersName As String '定義資料夾名稱為字串型態
- Dim strAllName As String '定義所有名稱
- 'Dim objFs2 As Scripting.FileSystemObject
-
- Dim fObj2, fc2
- Dim objF2 As Object
-
-
- Dim strFolderPath As String
- Dim strGetFilePath As String
- strGetFilePath = File1.Path
-
- strFolder = Text1.Text
-
- Set gobjFs = CreateObject("Scripting.FileSystemObject")
- Set objF = gobjFs.GetFolder(strGetFilePath)
- Set fc = objF.SubFolders
-
- For Each F1 In fc
-
-
- 'Set oexcel = CreateObject("Excel.Application")
- MyPath = F1
- i = 0
- MyFile = Dir(MyPath & "\*_1.csv") '要開啟的資料檔名
-
- 'g = Mid(MyFile, 1, 18)
- Do While Len(MyFile) > 0
-
-
-
- Call class_NT
- Application.DisplayAlerts = False ' 關閉警告訊息
-
- Application.DisplayAlerts = True ' 再打開警告訊息
- i = i + 1
- MyFile = Dir '下一筆
- Loop
- Next
複製代碼 |
|