Help with code to change file name PLease

L

Les

Hi all, i have a string variable with the path that i retrieved my file from
and i need to save the file after manipulation to the same path, just with a
"ZA_" in front of the file name. e.g.
Get:
\\nv09001\za-t-m-2$\Department\T-M-22\Kevin\Projects\EM-13 SBM Workshops
07\FII 08\LIPEK_2008_080429.xls

Save:
\\nv09001\za-t-m-2$\Department\T-M-22\Kevin\Projects\EM-13 SBM Workshops
07\FII 08\ZA_LIPEK_2008_080429.xls

Thank you for any help in advance..
 
R

Rick Rothstein \(MVP - VB\)

Try this code structure...

GetName = "c:\dir1\dir2\dir3\file.txt
LastSlash = Instrrev(GetName,"\")
SaveName = Left(GetName, LastSlash) & "ZA_" & Mid(GetName, LastSlash + 1)

Rick
 
L

Les

Thanx Rick


--
Les


Rick Rothstein (MVP - VB) said:
Try this code structure...

GetName = "c:\dir1\dir2\dir3\file.txt
LastSlash = Instrrev(GetName,"\")
SaveName = Left(GetName, LastSlash) & "ZA_" & Mid(GetName, LastSlash + 1)

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top