User Profile
Lio_Nel
Copper Contributor
Joined Feb 20, 2023
User Widgets
Recent Discussions
Re: Excel VBA and OneDrive SaveCopyAs
Had the same problem I found this workaround. You simply need to relocate the URI file to local computer. Example : URI of a OneDrive localized file = "https://d.docs.live.net/b034d490c9cb9445/Documents/50 - Working" You have to rebuild the local path by replacing "https://.../.../" with local path. To do this you can get the OneDrive Path from the local environnement in vba with ENVIRON command => ENVIRON("OneDrive") return the local path of OneDrive Example here. Adapt it as you need 🙂 Public Function fRelocateOneDrivePath(strParamURIPath As String) As String Dim strPath As String Dim I As Integer ' Replace all "/" by "\" if exists strPath = Replace(strParamURIPath, "/", "\") If Left(strParamURIPath, 4) = "http" Then ' Remove the OneDrive URI part of the path : ex : "https://d.docs.live.net/b034d490c9cb9445/Documents/50 - Working" For I = 1 To 4 strPath = Mid(strPath, InStr(strPath, "\") + 1) Next ' Return path with local OneDrivePath fRelocateOneDrivePath = Environ("OneDrive") & "\" & strPath Else ' Do Nothing fRelocateOneDrivePath = strParamURIPath End If End Function18KViews0likes0Comments
Recent Blog Articles
No content to show