View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default How to create Automatic Filenames in Excel

Option Explicit
Sub testme03()

Dim myFileName As String

myFileName = ThisWorkbook.Worksheets("Sheet99").Range("a99").Va lue _
& "--" & Format(Now, "yyyy_mm_dd__hh_mm_ss") & ".xls"

ThisWorkbook.SaveAs Filename:=myFileName
End Sub

Not much testing--no folder included (unless it's in that cell).


Trevor6410 wrote:

I am trying to work out how to get Excel to automatically create the File
Name when the Workbook is saved. I want a filename to be create using the
contents of a given Cell + the current date/time... Ideally, I want a Macro
attached to the sheet which Saves the document.


--

Dave Peterson