Reflection Desktop VBA Guide
Attachmate.Reflection.Objects Library / Attachmate.Reflection.Objects.Web.Msie Library / WebControl Object / Close Method
The CloseOption enum object.
Example
In This Topic
    Close Method (WebControl)
    In This Topic
    Closes the Web session with the close option.
    Syntax
    expression.Close( _
       ByVal option As CloseOption _
    ) As ReturnCode
    where expression is a variable that represents a WebControl Object

    Parameters

    option
    The CloseOption enum object.

    Return Value

    One of the following ReturnCode values:
    Member Description
    Cancelled Cancelled.
    Error Error.
    PermissionRequired Permission is required.
    Success Success.
    Timeout Timeout condition.
    Truncated The text is truncated.
    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 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