View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
okrob okrob is offline
external usenet poster
 
Posts: 142
Default SaveAs no question...

Tom,
Man, I shoulda used some msgboxs to figure this out on my own...
Oh well, nothing like someone pointing out the obvious.
Thanks.
Rob


Tom Ogilvy wrote:
Activeworkbook.SaveAs FN doesn't show the saveas dialog.
Application.GetSaveAsFilename shows the saveas dialog.




--
Regards,
Tom Ogilvy

"okrob" wrote in message
ups.com...
I have a file I save weekly to several different names. I open the
workbook read only and after some modifications. I then copy the
worksheet to a new book. Tell the new workbook it's new name, then
save it to the same location every time. I want to keep the yes / no /
cancel alert for existing workbooks, but would like to get rid of the
saveas dialog completely. In otherwords, if the file doesn't already
exist, save with the filename I've given it.
Been looking though here, but most everyone wants to get rid of the
yes/no/cancel alert...

Anyway, my code example (probably taken from here in the past couple of
years):

Sub sav()
month = Evaluate("IF(MONTH(C4)9,MONTH(C4),0&MONTH(C4))")
day = Evaluate("IF(DAY(C4)9,DAY(C4),0&DAY(C4))")
year = Evaluate("RIGHT(YEAR(C4),2)")
With Application
FN = .GetSaveAsFilename("S:\MYPATH\" & Range("B2").Value & "\"
& Range("B2").Value & " " & month & day & year & ".xls")
If FN < False Then
ActiveWorkbook.ActiveSheet.Buttons.Delete
ActiveWorkbook.SaveAs FN <======== I'd like this to not
show the saveas dialog, just go ahead and save the darn thing with no
questions unless there's an existing workbook.
ActiveWorkbook.Close False
End If
End With
End Sub