Saturday, April 3, 2010

VBscript - How Can I Create a New Excel Spreadsheet at Midnight Each Night?

VBscript - How Can I Create a New Excel Spreadsheet at Midnight Each Night?

dtmDate = Date

strMonth = Month(Date)
strDay = Day(Date)
strYear = Right(Year(Date),2)

strFileName = "C:\Scripts\" & strMonth & "-" & strDay & "-" & strYear & ".xls"

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Add()
objWorkbook.SaveAs(strFileName)

objExcel.Quit

[Via]