OK, I created this routine to extract the filename, but it is making a few assumptions:
1) That real file paths will always start with "/"
2) That content uri's will always have "%3A" at the end, before the file name.
Sub GetFileNameFromContentResult(UriString As String) As String
If UriString.StartsWith("/") Then 'If the user used a file manager to choose file
Return UriString.SubString2(UriString.LastIndexOf("/")+3,UriString.Length)
else if UriString.StartsWith("content:") Then
If UriString.IndexOf("%3A") > -1 Then
Return UriString.SubString2(UriString.LastIndexOf("%3A")+3,UriString.Length)
Else if UriString.IndexOf("/") > -1 Then
Return UriString.SubString2(UriString.LastIndexOf("/")+3,UriString.Length)
Else
Return UriString
End If
Else
Return UriString
End If
End Sub
But, are these assumptions correct, or will there be exceptions?