As in
Code: Select all
Open <File> For Input As #1
Code: Select all
Open <File> For Input As #1
Code: Select all
With CreateObject("Scripting.FileSystemObject")
Debug.Print "Scripting.fso: "; .GetAbsolutePathName("File")
End With
Code: Select all
Private Function Local_File_Name(ByRef FileName As String) As String
'Returns local file path, empty if local path not found
Dim i As Integer, ShortName As String
'
If InStr(FileName, "https://") = 0 Then Local_File_Name = FileName: Exit Function 'Check if path is a OneDrive location
ShortName = Replace(FileName, "/", "\")
'Remove first four backslashes
For i = 1 To 4
ShortName = Mid(ShortName, InStr(ShortName, "\") + 1)
Next
'Double check if file found
ShortName = Environ("OneDrive") & "\" & ShortName
If Dir(ShortName) <> "" Then Local_File_Name = ShortName
End Function