PathStripPath
PathStripPath
(OP)
I am puzzled by the behavior of the Shell function PathStripPath in a VBA setting in that it merely overwrites the beginning of the string.
If I pass a string "C:\FolderABCD\File.txt" the resultant string value is:
"File.txt BCD\File.txt"
This is fortunately not a show stopper since there are alternative ways to trim off the path, but if there are any ideas as to why the behavioral oddity, I'd appreciate hearing them.
Thanks,
Bill
If I pass a string "C:\FolderABCD\File.txt" the resultant string value is:
"File.txt BCD\File.txt"
This is fortunately not a show stopper since there are alternative ways to trim off the path, but if there are any ideas as to why the behavioral oddity, I'd appreciate hearing them.
Thanks,
Bill
RE: PathStripPath
So you need to extract
Left$(strResult, instr(strResult, Chr$(0))-1)
or
Split(strResult,Chr$(0))(0)
RE: PathStripPath
Since I am only looping through a few dozen paths at the most, speed isn't an issue. But I will have to see whether it is more efficient to just use VB string functions or the API call or alternatively pass a fixed length string. The fixed length string gets a cleaner result, but the tail of the string still must be clipped.
Again, I appreciate your feedback.
Cheers, Bill