I have the following VBScript in a reusable action:
'Gather links Browser("1").Navigate "http://InternalWebmail/something/inbox.nsf" set oDesc = Description.Create() oDesc("micclass").Value = "Link" set links = Browser("1").Page("Webmail").ChildObjects(oDesc) Dim links2 links2 = "" 'Filter out irrelevant links For i = 0 To links.Count-1 If lcase(trim(links(i).GetROProperty("text"))) = lcase(trim(DataTable("ExpectedFrom", dtGlobalSheet))) Then links2 = links2 + "," + links(i).GetROProperty("url") End If Next Dim final final = split(mid(links2,2),",") 'Remove leading comma and split into array 'For each link (ie for each E-mail received): 'Effectively giving a reusable action an input parameter, I hope For i = 0 To final.Count - 1 'error: Object Required DataTable("url","CheckHeader") = final(i) RunAction "CheckHeader", oneIteration Next
Everything works fine until I get to the declaration of the loop at the bottom of the fragment. There QTP gives me an "Object Required" error and refuses to develop.
- I have an initial value of 58, although I tried setting it to 0 before entering the loop.
- final - an array of 6 lines, each of which has a URL. Everyone matters.
- If I am msgbox (final (2)), I see that the value of final (2) is valid.
- isobject (final (1)) = false
- final (1) has the correct value
- msgbox (final is nothing), and msgbox (final (1) is nothing) gives the same error.
It looks like the array is NULL, but somehow there are members in the array? How is this possible? What is QTP talking about?
tsilb source share