LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Rename and save without overwriting the exisiting file

I have a macro (given below) that saves a new workbook with the name
Book1. Next time when the macro is executed, how the code should be
tweaked such that the new workbook is saved in a different name? I
tried using "i" loop but that doesnt merge well in my case as this
part is a part of a huge code. I

In short, I would like to have a macro for the following algorithmn
for this one:
If the filename is already found, then add any character (number,
alphabet) to save it as a different file name.

For example, initial save gives Book1.xls.
Next save finds Book1.xls, the filename should be renamed as
Book11.xls or Book1a.
Next save finds Book1 and Book11/Book1a. So, the filename should be
renamed as Book111 or Book11a or....
So on....

Can someone please help me with the macro?

ActiveWorkbook.SaveAs Filename:= _
"C:\Book1.xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False

Thanks!
Thulasiram

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rename current file save and delete original valve79 Excel Programming 0 January 13th 06 09:17 PM
How to set SAVE AS file name to equal A1 contents when rename file E Excel Discussion (Misc queries) 0 October 19th 05 08:36 PM
overwriting a file Jordan Shoderu Excel Programming 4 August 6th 04 11:46 AM
Macros in Excel - Save as and rename file Tom Ogilvy Excel Programming 0 August 13th 03 12:13 PM
Macros in Excel - Save as and rename file Bob Phillips[_5_] Excel Programming 0 August 13th 03 09:28 AM


All times are GMT +1. The time now is 01:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"