VBA: Move File and rename it (Use current path)

LNG2013

Active Member
Joined
May 23, 2011
Messages
466
I need help moving a file and renaming a file, but I can't use the traditional:

Code:
[COLOR=#009900][COLOR=#009900]Sub DoMove()[/COLOR]
[COLOR=#009900]Name "c:\folder1\test.xls" As "c:\folder2\test.xls"[/COLOR]
[COLOR=#009900]End Sub[/COLOR]
 
 
[/COLOR]


I need to be able to have this run in the current working in directory, this is because the macro gets moved onto different servers to run.

Eg. \folder1\test.xls as \folder2\test-7-18-2011.xls
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Why do you not use the CurDir function to get the current directory. So it does not matter in which directory your files are located.
 
Upvote 0
The best way to get more info is to help the help in VBA. There are also some examples.
 
Upvote 0
Thanks for the info I tested some things out and still cant get it to work. Any help is always appreciated.
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,240
Members
452,898
Latest member
Capolavoro009

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