ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with code to change file name PLease (https://www.excelbanter.com/excel-programming/410870-help-code-change-file-name-please.html)

Les

Help with code to change file name PLease
 
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..
--
Les

Rick Rothstein \(MVP - VB\)[_1920_]

Help with code to change file name PLease
 
Try this code structure...

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

Rick


"Les" wrote in message
...
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..
--
Les



Les

Help with code to change file name PLease
 
Thanx Rick


--
Les


"Rick Rothstein (MVP - VB)" wrote:

Try this code structure...

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

Rick


"Les" wrote in message
...
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..
--
Les





All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com