Hi Guys,
I need help adding a date to a Workbook that I create using VBA. Below is the code that I'm using to create the workbook and to save it to CSV. It there a way to add a formula to this code to add the date to the actual name of the file? so the name of the file would look something like this "WK1-401K081022"
'Create a new file that will receive the data
Set newWB = Workbooks.Add
With newWB
Set newS = newWB.Sheets("Sheet1")
newS.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
newWB.Sheets("Sheet1").Range("B:B").NumberFormat = "m/d/yyyy"
'Save in CSV
Application.DisplayAlerts = False
.SaveAs Filename:="C:\DOWNLOADS\WK1-401K.csv", FileFormat:=xlCSV
Application.DisplayAlerts = True
Workbooks("WK1-401K").Close SaveChanges:=True 'SaveAndCloseExcelSheet
Thank you, I appreciate any help
I need help adding a date to a Workbook that I create using VBA. Below is the code that I'm using to create the workbook and to save it to CSV. It there a way to add a formula to this code to add the date to the actual name of the file? so the name of the file would look something like this "WK1-401K081022"
'Create a new file that will receive the data
Set newWB = Workbooks.Add
With newWB
Set newS = newWB.Sheets("Sheet1")
newS.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
newWB.Sheets("Sheet1").Range("B:B").NumberFormat = "m/d/yyyy"
'Save in CSV
Application.DisplayAlerts = False
.SaveAs Filename:="C:\DOWNLOADS\WK1-401K.csv", FileFormat:=xlCSV
Application.DisplayAlerts = True
Workbooks("WK1-401K").Close SaveChanges:=True 'SaveAndCloseExcelSheet
Thank you, I appreciate any help