Could someone please help me with this problem that is driving me insane.
I have a String "c:\dir1\dir2\file.jpg" which will change..
I need to manipulate this to and break it into 2 pieces, the dir structure and the filename.
var1 = c:\dir1\dir2\
var2 = file.jpg
TIA for any help offered.
dGc
Use InStrRev to search for the last occurence of the "\" and then use the Right function to take everything from there to the end of the string which you can get using Len.
loquin
01-30-2004, 07:38 AM
Or, the MID$ function by default returns everything to the right of the starting position you choose...
Or, the MID$ function by default returns everything to the right of the starting position you choose...
THANK YOU BOTH !!
that worked very well.
dGc
Frank2808
01-30-2004, 08:04 AM
This piece of code will parse out the directory:
strDir = Mid$(strEntirePath, 1, InStrRev(strEntirePath, "\") - 1)
where strEntirePath is a string containing something like:
"C:\temp\test.xls"
Hope that helps
Mandelbrot
01-30-2004, 08:26 AM
You could try this, also (it may be a little over the top for what you need)...
http://www.visualbasicforum.com/showthread.php?t=91548
Paul.