Reflection Desktop VBA Guide
Attachmate.Reflection.Objects Library / Attachmate.Reflection.Objects.Web.Msie Library / WebControl Object / Document Property
Example
In This Topic
    Document Property (WebControl)
    In This Topic
    Gets the Web document in the browser.
    Syntax
    expression.Document As WebDocument object 
    where expression is a variable that represents a WebControl Object

    Property Value

    A WebDocument object
    Example
    This example opens a Web session, waits a few seconds, and closes the session without saving. To run this sample, create and save a Web session named OpenWebDemo.urlx. Then open any session in Reflection Desktop and copy this code to a module in the Common project.
    'This example opens a Web session, waits a few seconds, and closes the session without saving
    Sub createAndCloseWebSession()
        'Declare application, terminal, and view object variables:
        Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
        Dim wControl As Attachmate_Reflection_Objects.WebControl
        Dim wDocument As WebDocument
        Dim view As Attachmate_Reflection_Objects.view
        Dim rcode As ReturnCode
        Dim path As String
            
        'Get a handle to the workspace
        Set app = GetObject("Reflection Workspace")
     
        'Open a session to create a Web control
        path = Environ$("USERPROFILE") & "\Documents\Micro Focus\Reflection\" & "OpenWebDemo.urlx"
        Set wControl = app.CreateControl(path)
       
        'Wait until the Web page is ready and then set it as the Web document
        Do Until wControl.ReadyState = WebBrowserReadyState_Complete
          app.Wait (1000)
        Loop
        
        Set wDocument = wControl.Document
     
        'Set a view to make the session visible
        Set view = ThisFrame.CreateView(wControl)
        
        'send additional commands to work with the session
        app.Wait (5000)
        
        'Close the session without saving
        rcode = wControl.Close(CloseOption_CloseNoSave)
     
    End Sub
    See Also