Thursday, August 18, 2011

Function to "type" into web edits rather than using .set

Function objectType(objObject, parameter)
   On Error Resume Next
   objObject.Click
   Set oShell = CreateObject("WScript.Shell")
   oShell.SendKeys parameter
   oShell.SendKeys("{TAB}")
   Set oShell = Nothing
   If Err.Number = 0 Then
      objectType = True
   Else
      Reporter.ReportEvent micFail, "objectType", "Error # " & CStr(Err.Number) & "Error Detail: " & Err.Description & "Error source: " & Err.Source
      Err.Clear
      objectType = False
   End If
   On Error GoTo 0
End Function

You can call this function as
objectType(UserName, Arun)

No comments:

Post a Comment