View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Paige Paige is offline
external usenet poster
 
Posts: 270
Default Save As Then Replace Bombs Out

When I bring up the saveas menu, if someone selects an existing file and hits
Save, they then get the warning message saying the file already exists and do
they want to replace it. If they hit 'No' or 'Cancel', then the code errors
out. How do I fix this? I still want them to get the warning message, but
if they select 'No' or 'Cancel', the message should disappear and take them
back to the saveas menu so they can select another file or enter a new file
name. The current code I'm using is:

Do
FName = Application.GetSaveAsFilename(InitialFileName:="",
FileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
Loop Until FName < False
ActiveWorkbook.SaveAs Filename:=FName, FileFormat:=xlWorkbookNormal

Appreciate any help I can get on this; thanks....