| 
    
     |  | こんばんは。 
 >Cells(D, 8)には、\\<コンピュータ名>\temp
 Dが変数なら別ですが、Cells(8,"D")の間違いでは?
 
 Cells(8,"D")には、\\<コンピュータ名>\temp\
 「\」もいるのでは?
 違ったらごめんなさい。
 
 Dir(Cells(8,"D"), vbDirectory) としただけでは、ファイルがなければよいのですが、フォルダだけでなくファイルも取得されます。
 
 ヘルプでは、取得したものがフォルダかどうかを判定しているようですが・・・
 
 Sub test()
 Dim myFol As String
 Dim myPath
 Dim mAry() As Variant
 
 myPath = Cells(8, "D").Text & "\"
 myFol = Dir(myPath, vbDirectory)
 Do While myFol <> ""
 If myFol <> "." And myFol <> ".." Then
 If GetAttr(myPath & myFol) = vbDirectory Then ’←ここ
 Debug.Print myFol
 End If
 
 End If
 myFol = Dir
 Loop
 End Sub
 
 FSOのGetfolderのほうがいいかもしれません。
 
 Sub FSOtest()
 Dim FSO As Object
 Dim myPath As String
 Dim myFolders As Object
 Dim myFol As Object
 
 Set FSO = CreateObject("Scripting.FileSystemObject")
 
 myPath = Cells(8, "D").Text
 Set myFolders = FSO.GetFolder(myPath).subfolders
 If myFolders.Count <> 0 Then
 For Each myFol In myFolders
 Debug.Print myFol.Name
 Next
 Else
 MsgBox "フォルダはありません"
 End If
 End Sub
 
 
 |  |