広告
広告
ファイル名(フルパス)分解関数。フルパスから、ドライブ名、ディレクトリ名、ファイル名、拡張子名を抽出する。
| 第一引数 | ファイル名(フルパス) |
|---|---|
| 戻り値1 | strDrive as String[ドライブ名] |
| 戻り値2 | strDirectory as String[ディレクトリ名] |
| 戻り値3 | strFileName as String[ファイル名] |
| 戻り値4 | strExt as String[拡張子名] |
Option Compare Database
Public strDrive As String
Public strDirectory As String
Public strFileName As String
Public strExt As String
Public Function GetPathName(strFileFullPath As String)
Dim objFso As Object
Set objFso = CreateObject("Scripting.FileSystemObject")
With objFso
strDrive = .GetDriveName(strFileFullPath)
strDirectory = Mid$(.GetParentFolderName(strFileFullPath), Len(strDrive) + 1)
If Right$(strDirectory, 1) <> "\" Then strDirectory = strDirectory & "\"
strExt = .GetExtensionName(strFileFullPath)
If Len(strExt) > 0 Then strExt = "." & strExt
strFileName = .GetFileName(strFileFullPath)
End With
End Function
広告