Not a vbscript expert and I'm beginning to wonder if I remember any of it.
I simply want to obtain today's date without generating, "Microsoft VBScript runtime error: Object required: 'aqDateTime' at line (21,1)". I know it will be obvious to someone here and should probably be obvious to me too.
I am working with an Excel spreadsheet that will need to have cells updated with another date based off of whatever today's date happens to be. Obtaining today's date is the problem for me.
Below is the relevant code. The line near the end of the snippet, "CurrentDate = aqDateTime.Today" is where the error occurs.
I'm not just looking for help on the code though. I would appreciate learning the reasons behind it too. What am I overlooking? Thanks!
dim CurrentDate
dim objExcel, objWorkbook, objWorksheet, strCellValue
'Launch Excel
Set objExcel = CreateObject("Excel.Application")
'Make the spreadsheet visible
objExcel.Application.Visible = True
'Open the workbook
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\QA_Admin\Report\transactiontemplate.xls")
'Select a worksheet
Set objWorksheet = objWorkbook.Worksheets(1)
'Obtain the current date
CurrentDate = aqDateTime.Today
DayOfWeek = aqDateTime.GetDayOfWeek(CurrentDate)
.....
aqDateTime
in your code, so you can't read itsToday
property. Where do you magically expectaqDateTime
to appear from? You can't access an object that you haven't declared and assigned a value to first. – Ken White