Create new workbook

  • Thread starter Thread starter Kevin G
  • Start date Start date
K

Kevin G

How would I create a new work book and name it from an active workbook name
& todays date?
 
Sub test()
Dim strFileName As String

strFileName = ActiveWorkbook.Name
If Right(strFileName, 4) = ".xls" Then
strFileName = Left(strFileName, Len(strFileName) - 4)
End If

With Workbooks.Add
.SaveAs strFileName & Format(Date, "yyyymmdd")
.Close
End With
End Sub
 
Back
Top