ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing filenames using theSaveAsCopy method (https://www.excelbanter.com/excel-programming/303738-changing-filenames-using-thesaveascopy-method.html)

davidoo2005

Changing filenames using theSaveAsCopy method
 
Here's the problem: I would like to open a file, for instance C:\Documents and Settings\Me\Folder1\file.xls, perform some basic operations, and save it as C:\Documents and Settings\Me\Folder2\file.xls. How can I alter the filename in such a way?

Frank Kabel

Changing filenames using theSaveAsCopy method
 
Hi
in your macro use the .saveas method. e.g. try something like the
following:
sub foo()
dim wbk as workbook

workbooks.open "C:\Documents and Settings\Me\Folder1\file.xls"
set wbk=activeworkbook
'perform your stuff
wbk.saveas "C:\Documents and Settings\Me\Folder2\file.xls"
end sub


--
Regards
Frank Kabel
Frankfurt, Germany


davidoo2005 wrote:
Here's the problem: I would like to open a file, for instance
C:\Documents and Settings\Me\Folder1\file.xls, perform some basic
operations, and save it as C:\Documents and
Settings\Me\Folder2\file.xls. How can I alter the filename in such a
way?




All times are GMT +1. The time now is 04:24 AM.

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