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: 58
Default the file already exists - do you want to replace the existing file?

I've got a VBA procedure that saves a record to disk using
Application.GetSaveAsFilename. However, if the file it's trying to save
already exists, the Windows API generates the above message, and the user's
only option is to either replace the existing file, or manually rename the
existing file in the File Save As.

What I'd really like to do is modify the code so that when it's run, it
takes care of renaming the existing file (if it exists) by adding a "1" to
the end of the filename, then saving the file in memory with the original
name, all without requiring the user to do anything. For simplicity, I'd be
happy to keep appending the character "1" to the end of any previously
renamed files in case this operation is performed multiple times, instead of
trying to increase the appended digit by 1 each time.

Is there any VBA code I can use to accomplish this?

Thanks in advance.

Paul


 
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
User replaces existing file with blank during file open sjs Excel Discussion (Misc queries) 3 August 18th 08 06:16 PM
Importing text file, only option to edit existing file smokey99 Excel Discussion (Misc queries) 8 April 26th 06 09:08 PM
can i save an existing .xls file as a .csv file using command line craigkan Excel Discussion (Misc queries) 2 February 18th 05 02:01 PM
How do you replace an existing file, saying "yes" in a macro? Chris Excel Programming 0 November 19th 03 03:25 PM
Automatically replace existing file on save ronber[_2_] Excel Programming 1 September 25th 03 10:05 PM


All times are GMT +1. The time now is 10:02 PM.

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

About Us

"It's about Microsoft Excel"