I create this code do get a random Date in a Range. I support it from some sites and answers here at stack from others. This works whit no problems, but when i try too pass at one function keep giving error.
StartDate = "01-01-1950"
EndDate= "31-12-2000"
StartDate = CDate(StartDate)
EndDate= CDate(EndDate)
Randomize
dtmRandomDate = DateValue((EndDate- StartDate + 1) * Rnd + StartDate )
Browser("DashBoard_2").Page("DashBoard").WebEdit("txtBornDate").Set dtmRandomDate
The error:
The function:
Function DataRandom(StartDate, EndDate)
Dim StartDate, EndDate
StartDate = CDate(StartDate)
EndDate= CDate(EndDate)
Randomize
dtmRandomDate = EndDate((dtmEndDate - StartDate+ 1) * Rnd + StartDate)
End Function
I think the problem it's in the way i pass the Variables. Something about date functions that im missing it to declare, making the variable accept the date? It's something about the UFT system himself?
Already try somethings, but didnt worked.
Thank You, Best Regards
