Can I rename a directory using a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is the a way to rename the directory the open excel file is in, using a macro?
ex: C:\test\test.xls to C:\new\test.xls using a macro in test.xls

Thanks
 
Hi Harvey,

You can use the builtin Name function

name "C:\MyTest\Volker.xls" aS "c:\MYtEST\Volker1.xls"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Harvey,

Assuming that the destination folder exists, use

Name "C:\Test\Test.xls" As "C:\New\Test.xls"

If the folder does not exist, use MkDir to create the folder
first:

MkDir "C:\New"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top