View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Can I save an excel file as a particular cells value?


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim str As String

If SaveAsUI Then
str = Format(Range("A1").Value, "yyyymmddhhmmss") & ".xls"
Application.EnableEvents = False
Application.Dialogs(xlDialogSaveAs).Show arg1:=str
Application.EnableEvents = True
Cancel = True
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Leonard" wrote in message
...
I am trying to automatically (through a macro) save an excel file as a date
and time which is the value of the A1 cell. Is there a way to incorporate
the A1 cell value in the file name when you go to save as?