rename and delete file in vba for Excel

sal21

Active Member
Joined
Apr 1, 2002
Messages
291
2 siple question

... i want to rename file present in c:\test.txt in test01.txt
... i want to delete c:\test.txt

how make this in vba for Excel?

Please a simple macro
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Kill path & Filename
Name path & filename as New Path & filename

Not sure about the Name command syntax, check the online help.
 
Upvote 0
No need to delete it, just rename it...

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> CopyAndDelete()
    Name "C:\Test.txt" <SPAN style="color:#00007F">As</SPAN> "C:\Test01.txt"
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0
Hi ! can you give me. english version of excel descrebe below. tahanks

for renaming picture files (works slow, unfort., but you can see the pictures)
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,011
Members
449,204
Latest member
tungnmqn90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top