01-28-2010, 08:52 PM
(This post was last modified: 01-28-2010, 08:58 PM by Anshoo Arora.)
Hi Vijay,
When you attempt to create an object collection with the index as one of the defining properties, you're limiting the size of the object collection as well as stating that you're certain of the object to be retrieved through the use of the ordinal identifier. If you remove the below line of code, and create your function, you should see better results.
Secondly, you can improve performance in your code if you use the property within the description object instead of looping through all items and finding the button with the correct name. Since your code clicks the first found WebButton, wouldn't it be better to limit your code to the following:
Lastly, the below lines of code:
should be:
I hope this helps.
Correction in my last statement:
Lastly, the below lines of code:
should be:
When you attempt to create an object collection with the index as one of the defining properties, you're limiting the size of the object collection as well as stating that you're certain of the object to be retrieved through the use of the ordinal identifier. If you remove the below line of code, and create your function, you should see better results.
Code:
WbButton("Index").Value = 1
Secondly, you can improve performance in your code if you use the property within the description object instead of looping through all items and finding the button with the correct name. Since your code clicks the first found WebButton, wouldn't it be better to limit your code to the following:
Code:
Set WbButton = Description.Create()
WbButton("micclass").Value = "WebButton"
WbButton("name").Value = strName
Set AllWbButton = Browser("micclass:=browser").page("micclass:=page").ChildObjects(WbButton)
AllWbButton(0).Click
Lastly, the below lines of code:
Code:
If WBname = strName Then
ClickWebButton = True
should be:
Code:
If WBname = strName Then
ClickWebButton = True
I hope this helps.
Correction in my last statement:
Lastly, the below lines of code:
Code:
If WBname = strName Then
WbButtonFound = True
should be:
Code:
If WBname = strName Then
ClickWebButton = True