Rename and move file to an existing folder (1 Viewer)

PISCES

Registered User.
Local time
Yesterday, 23:30
Joined
Mar 11, 2004
Messages
12
Hi Group,
I have the following code:

newname= "H:\nob\" & left$(strFile,len(strFile)-4) & ".txt"

but what is returned for newname is the literal string.
I want the file to go to the H:\Nob folder which exists.

left$(strFile,len(strFile)-4) resolves to this 6310104.

So what I want is 6310104.txt in the H:\nob\ folder.

Kind Regards
 

ghudson

Registered User.
Local time
Today, 02:30
Joined
Jun 8, 2002
Messages
6,195
Check out the Name Statement in the Access help files for more info and examples.

Code:
OldName = "C:\MYDIR\OLDFILE": NewName = "C:\YOURDIR\NEWFILE"
Name OldName As NewName	' Move and rename file.
 

Kodo

"The Shoe"
Local time
Today, 02:30
Joined
Jan 20, 2004
Messages
707
That's handy! Thanks :)
 

mr_e_landis

Registered User.
Local time
Yesterday, 23:30
Joined
Feb 16, 2005
Messages
28
SCORE!!!
THIS IS AWESOME!!!
Code:
OldName = "C:\MYDIR\OLDFILE": NewName = "C:\YOURDIR\NEWFILE"
Name OldName As NewName	' Move and rename file.
Works great and takes care of both of the issues I faced with renaming and moving the file!!! SWEET!
Thanks!
 
Last edited:

Users who are viewing this thread

Top Bottom