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: 10
Default VBA Save As problem with file that already exist

Hi!

I have the following macro:

Sub save()
FN = Sheet1.Range("H30").Text
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & FN
ActiveWorkbook.close
End Sub


that works correct except if I already have the file with the same name.
In that case I got Excel message:
A file named " ......... " already exists in this location.
If I click 'No' or 'Cancel' the SaveAs gives me an error:
Run-time error '1004'

I don't want to use the Application.DisplayAlerts = False,
because I want the user to be aware that there is a file already named the
same.

I want on case 'No' to bring up the save as dialog box
and on Case Cancel to exit from macro

Thank you for reading this especially if you are able to help me out on
this.


 
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
Save as File Problem Maperalia Excel Programming 2 December 19th 08 03:27 PM
Save file in a new folder, but create folder only if folder doesn't already exist? nbaj2k[_40_] Excel Programming 6 August 11th 06 08:41 PM
Command Line. How to tell to XL : If the xls file exist : Open it, if it does not exist : Create it. Tintin92 Excel Programming 3 March 11th 06 06:45 PM
file save problem ricksimm[_6_] Excel Programming 0 September 28th 05 10:17 PM
Save to directory and create if not exist Rob Excel Programming 8 January 29th 05 05:39 PM


All times are GMT +1. The time now is 06:10 AM.

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"