Link to home
Start Free TrialLog in
Avatar of npl77
npl77

asked on

String Manipulation on a file path VBA

Can someone help me with some string manipulation code on a file path using VBA.

Here is an example (please try and give me code that will pertain to any given file path)

"C:\Documents and Settings\w6068c\My Documents\My Pictures\Natan.jpg"

-I need to extract the path of the folder (i.e. "C:\Documents and Settings\w6068c\My Documents\My Pictures")
-The file itself "Natan.jpg"
-And the extension ".jpg"

Thanks In Advance
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

dim f as string, filePath as string

f="C:\Documents and Settings\w6068c\My Documents\My Pictures\Natan.jpg"

filePath=left(f,instrrev(f,"\")-1)
Avatar of npl77
npl77

ASKER

what about the folder path and the extension?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial