FSO: метод GetAbsolutePathName
Синтаксис:
GetAbsolutePathName(<Pathspec>)
Назначение: возвращает полный путь для заданного относительного пути (из текущего каталога).
Параметры:
- <Pathspec> – строка, относительный путь.
Пример:
Set FSO = CreateObject("Scripting.FileSystemObject")
Path = FSO.GetAbsolutePathName("..")
MsgBox Path
Path = FSO.GetAbsolutePathName(".\aaa\bbb\ccc.txt")
MsgBox Path
Метки: CreateObject("Scripting.FileSystemObject") , FSO , FSO.GetAbsolutePathName("..") , GetAbsolutePathName , SetFSO
' ==============================================================================================
Function get_folder_path(ByVal oWb As Workbook)
''early binding
'Dim fso As FileSystemObject
'Set fso = New FileSystemObject
'late binding
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim folder As String
folder = fso.GetAbsolutePathName(oWb.Name)
'Debug.Print (folder)
End Function
' ==============================================================================================