(Solved) – Powerpoint VBA – not getting path correctly

(solved)-–-powerpoint-vba-–-not-getting-path-correctly

I have the following code:

'Get file path
Dim fullName As String, justNameWithExt, justName As String, justPath As String
fullName = ActivePresentation.fullName
justNameWithExt = ActivePresentation.Name
justPath = Replace(fullName, justNameWithExt, "", 1)
justPath = Replace(justPath, "https://stackoverflow.com/", "")
justPath = Left(justPath, Len(justPath) - 1)
justName = Left(ActivePresentation.Name, Len(ActivePresentation.Name) - 5)

' Debug.Print justPath
' The path here starts with https:\d.docs.live.net5564dc20c06306b2
' But it should start with C:UsersUserOneDrive

ChDir justPath ' This throws an error - "Path not found"

It is meant to get the current path change the directory to it. The problem is (as described in the comments below Debug.Print justPath) that it’s not getting the correct path.

How do I fix this?

Leave a Reply

Your email address will not be published. Required fields are marked *