Reflection Desktop VBA Guide
Attachmate.Reflection.Objects Library / Attachmate.Reflection.Objects.Web.Msie Library / WebElement Object / GetText Method
Example
In This Topic
    GetText Method (WebElement)
    In This Topic
    Gets text from the text field if the Web element is an input text type.
    Syntax
    expression.GetText() As String
    where expression is a variable that represents a WebElement Object
    Example
    This sample gets the text in a form field and prints the Web page.
    'This sample gets text from a field in a Web form
    Sub GetTextFromForm()
        
        Dim Field As WebElement
        Dim Name As String
        
        'Get the First Name form field
        Set Field = ThisWebControl.Document.GetElementById("fname")
        
        'Get the text in the field
        Name = Field.GetText
        
        MsgBox Name
        
        'print the form
        ThisWebControl.PrintPage
           
    End Sub
    See Also