You want to use the GetFileName method of the file system object:
dim fso
set fso = CreateObject( "Scripting.FileSystemObject" )
dim sFullName, sJustName, sJustPath
sFullName = "c:\folder1\folder2\folder3\filename.txt"
sJustPath = fso.GetParentFolderName( sFullName )...