![]() |
Using Dir function to find folders
Can someone provide me with a working code snippet to find all folders in a
directory on a Mac? I'm running Excel 2004 on a mac, and know that I need to use something like FolderName = Dir(Input_Dir, MacID("TEXT")) but something other than "TEXT" needs to go there. Can someone tell me what the resource type is that I need to use to specify a folder? Actually, I want to find the names of all sub folders within a folder so I think I need to call it as above and then call FolderName = Dir("", MacID("TEXT")) or something like that for subsequent calls. Thanks! |
Using Dir function to find folders
I found a way to do it without MacID. Here's what worked for me:
On Error Resume Next subDir(1) = Dir(pathTbox, vbDirectory) On Error GoTo 0 If subDir(1) = "" Then MsgBox "No sub directories were found in " & pathTbox Exit Sub End If j = 1 While subDir(j) < "" On Error Resume Next j = j + 1 subDir(j) = Dir() On Error GoTo 0 Wend j = j - 1 msg = "" For i = 1 To j msg = msg & subDir(i) & vbCr Next i MsgBox "The " & j & " sub directories found were " & msg Stop "T_o_n_y" wrote: Can someone provide me with a working code snippet to find all folders in a directory on a Mac? I'm running Excel 2004 on a mac, and know that I need to use something like FolderName = Dir(Input_Dir, MacID("TEXT")) but something other than "TEXT" needs to go there. Can someone tell me what the resource type is that I need to use to specify a folder? Actually, I want to find the names of all sub folders within a folder so I think I need to call it as above and then call FolderName = Dir("", MacID("TEXT")) or something like that for subsequent calls. Thanks! |
All times are GMT +1. The time now is 05:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com