O
okrob
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
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