NAME

NAME oldpathname As newpathname

Renames an existing file or directory.


oldpathnameThe full pathname of the file or directory you want to rename (String).
newpathnameThe full pathname of the file or directory to be created (String).

REMARKS
* You cannot prefix this statement with "VBA."
* If you try to rename a file that is currently open you will get a run-time error.
* If you try to rename a file that does not exist you will get a file not found error.
* If either of the folders do not exist you will get a file not found error.
* This subroutine can only be used to rename an existing directory when both the old and new exist on the same drive.
* For the Microsoft documentation refer to learn.microsoft.com

Name "text.txt" As "test2.txt" 
Name "C:\Temp\" As "C:\Temp2\"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top