パス、ファイルを分割表示 | 備忘録 (。・_・。)ノ
Sub test()
Dim objFs As Object
Dim strPath As String
Dim strFile As String
Const aaa = "C:\ak\down\aaa.txt"
'1
strPath = Left(aaa, InStrRev(aaa, "\"))
strFile = Mid(aaa, InStrRev(aaa, "\") + 1)
MsgBox strPath & vbCrLf & strFile
'2
strPath = Left(aaa, Len(aaa) - Len(Dir(aaa)))
strFile = Dir(aaa)
MsgBox strPath & vbCrLf & strFile
'3
Set objFs = CreateObject("Scripting.FileSystemObject")
strFile = objFs.GetFileName(aaa)
strPath = objFs.GetParentFolderName(aaa)
Set objFs = Nothing
MsgBox strPath & vbCrLf & strFile & "(\なし)"
End Sub