View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kevin Kevin is offline
external usenet poster
 
Posts: 20
Default Error on SaveAs Macro

I got this code from this forum and use it on a spread sheet, it works fine
in till you save a second time and then it ask "A file.... by this name
already exits, do you want to save it?" if I choose OK then the macro works
fine, but if I choose NO or Cancel then I get an error "Run time error 1004;
Method 'Saveas' of Object_Workbook failed". Is not really that important but
I would like it to just to work right! It does what it supposed to do except
for the annoying message!

Thank for your help in advance
Kevin Brenner

Sub SaveNowDate()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "mm-dd-yyyy")
Set wb = ActiveWorkbook
With wb
.SaveAs Sheets(1).Range("F3").Value _
& " " & strdate & ".xls"
End With
Cancel = True
End Sub