[code]Dim fPDF As folderitem
fPDF = New FolderItem(CList, FolderItem.PathTypeNative)
If fPDF <> Nil And fPDF.Exists Then
PDFFile = WebFile.Open(fPDF)
PDFFile.ForceDownload = True
End If
If PDFFile <> Nil Then
ShowURL(PDFFile.URL)
Else
MsgBox(“The PDF file is not available.”)
End If
[/code]
I placed a breakpoint at if fPDF… to evaluate the variables. In the case at hand, CList is “S:\TEMP\redbook 2016-2017 eng.pdf” I never get to open the webfile, because fPDF generates an error 105. invalid filename.
If I put the CList string in File Explorer, I open the target file correctly, so I know that the string is good. I can’t figure out why I am getting this error 105. It is probably something really simple, but I just cant figure it out. I tried with underscores instead of spaces in the filename, same result.
Eli, that may be right, but as I indicated, I had undercores in place of spaces before. Error 105 was happening regardless. I forgot to mention that this is on Windows 10.
As it turns out, adding CList = TRIM(CList) before fPDF = New FolderItem(CList, FolderItem.PathTypeNative) corrects the error.
I don’t quite understand why, since File Explorer opened the file just fine using the CList string. In any case, some null or non-printable character was apparently causing the error.