View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Using "InstrRev"

What you're seeing is the designed behaviour. Position from start of string,
searching from end of string.
You could subtract that number from Len(argFullName) to get the number you
want.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"quartz" wrote in message
...
Please note that I failed to complete an edit in my OP:

argFullName should be changed to strPath in line 3. Sorry for the
confusion.

"quartz" wrote:

Excel XP with Windows 2000
When I use the following:

Dim strPath as String
Dim lngSlash1 as Long
strPath = "\\TEST1\TEST2\TEST3\TEST4\"
lngSlash1 = InStrRev(argFullName, "\", -1, vbTextCompare)

I would expect lngSlash1 to return 1 since the last character is a "\".
However, the above function returns 26 for me. I thought "InStrRev" was
supposed to return the position from the END of the string, not the
beginning.
Where am I going wrong?

TIA.