1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Function GetLocalPath(Path As String, Optional OneDriveName As String) As String
' Renvoie le chemin local du classeur
' Author : Philippe Tulliez (https://magicoffice.be)
' Version : 1.1
' Arguments
' Path ' le chemin du classeur
' [OneDriveName] ' [d:=OneDrive] Environ ou EnvironCommercial
'
Dim LocalRootOneDrive As String
Dim p As Integer
Dim old_Path As String, new_Path As String
If Len(OneDriveName) = 0 Then OneDriveName = "OneDrive"
If Left(Path, 6) = "https:" Then
LocalRootOneDrive = Environ(OneDriveName) & "\"
p = InStr(1, Path, "/Documents") + 10
old_Path = Left(Path, p)
new_Path = Replace(Replace(Path, old_Path, LocalRootOneDrive), "/", "\")
GetLocalPath = new_Path
Else
GetLocalPath = Path
End If
End Function |
Partager