Cell A2 contains the following:
ABC123 List : 8/5/2022 2:53:31 PM
My code below encounters following error:
How to Replace illegal characters when naming file with cell value?
ABC123 List : 8/5/2022 2:53:31 PM
My code below encounters following error:
How to Replace illegal characters when naming file with cell value?
VBA Code:
Sub MySaveTabName()
With CreateObject("Scripting.FileSystemObject")
ActiveSheet.Name = "ABC - " & Format(Now(), "MM.dd.yy")
MyName = ActiveSheet.Range("A2").Value
End With
Const csPath As String = "C:\Test\"
ActiveWorkbook.SaveAs Filename:=csPath & MyName & ".xlsx"
End Sub