It's worth trying something like...

X = Dir("\\mysharepointshare\folder1\folder2\test.txt")
to detect the file. You can get the path from right clicking on the file in Sharepoint and copying the shortcut. You may need to trim off the http: prefix.