Help in creating a function to form an obejct
I want to perform the below statement
Aliases.ie.HomePage.SearchPanel.FindAHotel.SetText("London")
To execute this statement from a framework I will create
a function EnterText which takes the following inputs
a. Window
Name(for the example above the value will be "Aliases.ie.HomePage.SearchPanel")
b. Control
name(for the example above the value will be"FindAHotel")
c.
Parameter(for the example above the value will be "London")
The code snippet of the EnterText function is below
*********************************************************************************
Sub EnterText (strWindowName, strControlName, strValue)
Set objWin = Aliases.ie.HomePage.SearchPanel
Eval(objWin
& "." & strControlName).SetText(strValue)
If Err.Number <> 0 Then
BuiltIn.ShowMessage("Data entered correctly")
Else
BuiltIn.ShowMessage("Error in forming the Control. Please try
again")
End If
End sub
*************************************************************************************
I am setting the object ObjWin in the function itself to
the alias, But I am getting the error "Object doesn’t support this
property or method" when the cursor goes to Eval function
Also, can I pass the Parameter "
Aliases.ie.HomePage.SearchPanel" as strWindowName, rather than referencing
it within the function. For e.g., Can i call the EnterText function like this?
Call EnterText("Aliases.ie.HomePage.SearchPanel","FindAHotel","Test")
Can you please help me achieve my objective here(being
able to pass the required parameters to EnterText function to make it as a
modular function. An example will help
to understand it better
Let me know if you need more details on what exactly I am
trying to achieve here
Thanks,
Shiv