ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   changing the name of a file (https://www.excelbanter.com/excel-programming/290916-changing-name-file.html)

big G

changing the name of a file
 
Is there anyway to change the name of a file using VBA, also the files wont
be excel workbooks.

I have a macro that lists all the files in a selected directory in a
workbook, and want to modify it so you can change the name of any of the
files remotely.


Cheers,


G



Frank Kabel

changing the name of a file
 
Hi
you can use the VBAName statement:
sub foo()
strDirectory = "C:\temp\"
strName1 = "old_name"
strName2 = "new_name"
Name strDirectory & strName1 As strDirectory & strName2
end sub

Frank

big G wrote:
Is there anyway to change the name of a file using VBA, also the
files wont be excel workbooks.

I have a macro that lists all the files in a selected directory in a
workbook, and want to modify it so you can change the name of any of
the files remotely.


Cheers,


G





All times are GMT +1. The time now is 12:32 AM.

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