Vbscript 从Excel工作表中搜索WebList以查找特定项目计数

Vbscript 从Excel工作表中搜索WebList以查找特定项目计数,vbscript,listbox,qtp,Vbscript,Listbox,Qtp,我需要在VBScript或QTP中为以下情况提供帮助 例如: 我在网络列表中有将近40个项目。我在Excel表格中只有一项,它是weblist中40项中的一项。如果我运行脚本,Excel中的脚本应该在weblist中被选中。如何执行此操作?我尝试了很多场景,但都没能成功 下面是我在QTP中尝试的一些代码示例: ocount=Browser("name:=brw").Page("title:=brw").WebList("htmlid:=tabContainerBrandSite_123&

我需要在VBScript或QTP中为以下情况提供帮助

例如:

我在网络列表中有将近40个项目。我在Excel表格中只有一项,它是weblist中40项中的一项。如果我运行脚本,Excel中的脚本应该在weblist中被选中。如何执行此操作?我尝试了很多场景,但都没能成功

下面是我在QTP中尝试的一些代码示例:

ocount=Browser("name:=brw").Page("title:=brw").WebList("htmlid:=tabContainerBrandSite_123&rtyoh").GetROProperty("items count")

msgbox ocount

var7=mySheet2.Cells(2,"C")

For k=2 to ocount 

ocount2=Browser("name:=brw").Page("title:=brw").WebList("html id:=tabContainerBrandSite_123&rtyoh").GetItem(k)

msgbox ocount2
merchantName=DataTable(“商户名称”、“全局”)“值保存在全局表中的示例
items_count=浏览器(“Sarit”).Page(“Sarit_2”).WebList(“txtVendorCode”).GetROProperty(“items count”)'这将从您的WebList中获取所有项目。
i=1
做
webListName=浏览器(“Sarit”).Page(“Sarit_2”).WebList(“txtVendorCode”).GetItem(i)
'这将从web列表中获取第一个值
如果merchantName=webListName,则“将第一个值与全局表中的值进行比较”
浏览器(“Sarit”)。页面(“Sarit_2”)。网络列表(“txtVendorCode”)。选择(i)选择该值
退出do'因为它从本地工作表中找到了您的唯一值,所以它退出
其他的
i=i+1
如果结束
我走的时候兜圈子
merchantName = DataTable("Merchant_Name","Global") 'an example if value is saved in global sheet
items_count =  Browser("Sarit").Page("Sarit_2").WebList("txtVendorCode").GetROProperty("Items Count")  'This will get all the items from your weblist.

i = 1
Do

    webListName = Browser("Sarit").Page("Sarit_2").WebList("txtVendorCode").GetItem(i)
'this will get first value from the web list 
    If merchantName = webListName Then  'comparing first value from your value from global sheet
        Browser("Sarit").Page("Sarit_2").WebList("txtVendorCode").Select(i) 'selects that value
        Exit do 'because it has found your only value from the local sheet, it exits
        else
        i = i + 1
    End If
Loop While i <= items_count