Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use code/macro to change code/macro in an existing file? Scott Bedows Excel Programming 2 February 14th 07 05:50 AM
Change Code in Macro to specify file/folder to look in. Dtown Dawg Excel Programming 1 July 14th 06 06:34 PM
macro code to change file-opening password arunjoshi[_18_] Excel Programming 1 June 16th 05 08:49 AM
Import VBA Code in Excel-File ? (Export VBA Code to file) Matthias Pospiech Excel Programming 2 March 22nd 05 04:56 PM
Excel VBA - How do I programmatically change source code in another file? Lisa Norgaard Excel Programming 1 July 14th 04 04:09 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"