1) Before you define this as a function, temporarily modify it to a sub,
so you can check code execution.
2) I strongly recommend you use InStrRev with all optional stuff filled
in, especially the vbvompare bit. So that line should become
intLoc = InStrRev(strFullPath,"\",1,1) ' Start from position 1, and
compare for text.
Now, change the debug.print line to the following:
Debug.Print intLoc, " || ", strreturn
It should lead you to the answer. And if you can't wait, read on.
------------------------------------------------------------------------
----------------------------------------
You are looking in the full path, from the right, to where the first "\"
is. Now that you have that position, you are asking for all the stuff to
the LEFT of it, excluding the "\" as well.
I think you are getting the answer you have programmed the code to give.
If you want the full path, then that is available as strFullPath...