06-11-2010, 04:55 PM
(This post was last modified: 06-11-2010, 04:56 PM by vijayendra.shukla.)
Hi,
I am having trouble retreiving and then updating data from an array.
Here is my problem:
I am trying to get data from a WebTable cell. The data is a date with format "6/11/10 4:35 AM". Now I will have to split this data to get the date value "6/11/10".
Since the value I have to use should be in format of mm/dd/yyyy format so for that i thought of splitting the first index and concatenating the yy value with "20". But thats when I get the error "Subscript out of range: 'sToDate'".
Here is the line of code that I am using:
The sToDate value is "6/11/10 4:35 AM"
I am getting error in the last line. I even tried checking the value of sToDate(0,2) element but got the same error.
When I saw the value in Watch window, it is perfectly showing me it's value as "10". Attaching screenshot for the same.
PS - My problem is not getting the date in desired format as i know that can be done using CDate function. And in fact i have already done that. But I am not able to understand why I am getting the error for above logic. So this is just to solve my curiosity .
I am having trouble retreiving and then updating data from an array.
Here is my problem:
I am trying to get data from a WebTable cell. The data is a date with format "6/11/10 4:35 AM". Now I will have to split this data to get the date value "6/11/10".
Since the value I have to use should be in format of mm/dd/yyyy format so for that i thought of splitting the first index and concatenating the yy value with "20". But thats when I get the error "Subscript out of range: 'sToDate'".
Here is the line of code that I am using:
Code:
sToDate = Split(Browser("ABC").Page("ABC").Frame("fraMgr").WebTable("Table").GetCellData(2, 1), " ")
sToDate(0) = Split(sToDate(0), "/")
sToDate(0,2) = "20" & sToDate(0,2)
I am getting error in the last line. I even tried checking the value of sToDate(0,2) element but got the same error.
When I saw the value in Watch window, it is perfectly showing me it's value as "10". Attaching screenshot for the same.
PS - My problem is not getting the date in desired format as i know that can be done using CDate function. And in fact i have already done that. But I am not able to understand why I am getting the error for above logic. So this is just to solve my curiosity .