| 
    
     |  | 後半の処理は同じですが、フォルダ選択ダイアログを表示するサンプルです。 
 Sub getFolder()
 
 Dim objDlgSelFolder As Object     'Windows Shell object
 Dim strFile     As String
 Dim i        As Long
 
 'Create Dialogbox object
 Set objDlgSelFolder = CreateObject("Shell.Application"). _
 BrowseForFolder(0, "フォルダを選択してください", 0, "c:\\")
 If Not objDlgSelFolder Is Nothing Then
 'MsgBox objDlgSelFolder.Items.Item.Path
 strFile = Dir(objDlgSelFolder.Items.Item.Path & "\*.*")
 i = 2
 Do Until strFile = ""
 Cells(i, 1).Value = strFile
 strFile = Dir()
 i = i + 1
 Loop
 End If
 
 End Sub
 
 
 |  |