Hello,
I would want to know how to rename a file.
Thank you for your responses
best regards
philippe gendreau
Printable View
Hello,
I would want to know how to rename a file.
Thank you for your responses
best regards
philippe gendreau
If the file is one that you are renaming using VB, the syntax is
[vbcode]
Name oldname as newname
[\vbcode\
Just be sure to include the complete path in the oldname and newname values.
Example:
[vbcode]
Name "C:\My Documents\JunkDrawer.dat" as "C:\My Documents\UsefulStuff.dat"
[\vbcode]
Good luck...
hello,
thank you for your response.
But i want to rename a file with a instruction like "kill FileName"
A instrucction like "Rename Filename"
best regards
philippe gendreau
What do you mean? When you rename a file, you must provide both the old and the new filename. There is no other way. JimmyT's suggestion is the only one. Unless the new filename is always constant. If that's the case, you can create a function in which you pass the old filename only as a parameter and it renames it to the constant. Is that what you want?
Hello,
Sorry i don't understand the response.
this is what i know to do:
'close the file
Close #1
'open the file
Open sPathModele For Input As #1
'remove the file
Kill sPathModele
and what i don't know
'rename the file ?????????
thank your for your responses (sorry for my poor english)
best regards
Philippe gendreau
Now i think i understand what you want.
You must give the filename of the file you want to rename like JimmyT said.
Name "C:\My Documents\OldFileName" as "C:\My Documents\NewFileName"
Kill works the same way:
Kill "C:\My Documents\MyFile"
You cannot do the following:
dim sPathModele as Integer
Open sPathModele for input as #1
Kill sPathModele
It is wrong.
Ok Name works great
thanks