1

Macro in PathTest.xlsm:

Sub Makro1()
    Path = ActiveWorkbook.Path
    Range("A3").Value = Path

    Set fso = CreateObject("Scripting.FileSystemObject")
    Range("A4").Value = fso.FolderExists(Path)                    ' False!
    Range("A5").Value = fso.FileExists(Path + "\PathTest.xlsm")   ' False!
End Sub

This code works if file is stored in any normal folder, but when placed in Onedrive folder the check for existance fails.

Any hints? /Peter

Peter L
  • 21
  • 2
  • What does `Path` look like? FSO may be unable to scan an HTTP path for example. – Tim Williams Jun 02 '20 at 07:10
  • This will work if you use the function from [this solution](https://stackoverflow.com/a/73577057/12287457) to convert the path returned by `ActiveWorkbook.Path`. So copy the function from the linked post and use `Path = GetLocalPath(ThisWorkbook.Path)` – GWD Oct 22 '22 at 14:49

0 Answers0