現在ファイル名を一括取得するコードが出来上がっています。
下記のコードの一部分を変更することで
「フォルダ名」を取得することはできるでしょうか?
※できればフォルダ名のみ、がいいです。
「E2セル」に取得したいフォルダのパスを入力するという方法は変えたくないです。
Sub Get_FileName()
Const cnsTitle = "?t?@?C???????擾"
Const cnsDIR = "."
Dim xlAPP As Application
Dim strPath As String
Dim strFilename As String
Dim GYO As Long
Set xlAPP = Application Dim pass As String pass = Range("E2").Value Debug.Print (pass) '********************************************************* strPath = pass '********************************************************* If Dir(strPath, vbDirectory) = "" Then MsgBox "?w???t?H???_???????????B", vbExclamation, cnsTitle Exit Sub End If strFilename = Dir(strPath & cnsDIR, vbNormal) Do While strFilename <> "" GYO = GYO + 1 Cells(GYO, 1).Value = strFilename strFilename = Dir() Loop
End Sub
'-----------------<< End of Source >>------------------
宜しくお願いします。><
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/06 06:15