InfoConnect VBA Guide
Attachmate.Reflection.Objects.Framework Library / ApplicationObject Object / Close Method
An ApplicationCloseOption Enumeration value.
Example
In This Topic
    Close Method (ApplicationObject)
    In This Topic
    Closes the application.
    Syntax
    expression.Close( _
       ByVal closeOption As ApplicationCloseOption _
    ) 
    where expression is a variable that represents a ApplicationObject Object

    Parameters

    closeOption
    An ApplicationCloseOption Enumeration value.
    Example

    This example opens InfoConnect Desktop, creates a new IBM 3270 session, and then closes InfoConnect Desktop without saving the session. You can run this example from a Microsoft Excel macro as follows:

    On the Excel VBA Editor Tools menu, select References and then select the following InfoConnect Libraries:
    • Attachmate_Reflection_Objects
    • Attachmate_Reflection_Objects_Emulation_IbmHosts
    • Attachmate_Reflection_Objects_Framework

    Then copy the following code into an Excel Sheet object code window and press F5 to run the macro.

    'This example opens InfoConnect Desktop, creates a new IBM 3270 session, waits a few seconds and  then closes InfoConnect Desktop without saving the session
     
    Public WithEvents screen As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
    Public Sub applicationWaitExample()
        'Declare an object variable for the InfoConnect object
        Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
       
        'Declare additional InfoConnect objects, such as frame, terminal, and view
        Dim frame As Attachmate_Reflection_Objects.frame
        Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
        Dim view As Attachmate_Reflection_Objects.view
       
        'Create a new instance of InfoConnect
        Set app = New Attachmate_Reflection_Objects_Framework.ApplicationObject
     
        'wait until InfoConnect initializes
        Do While app.IsInitialized = False
            app.Wait (200)
        Loop
     
        'Create controls to open and display the session document.
        Set frame = app.GetObject("Frame")
        frame.Visible = True
       
        Set terminal = app.CreateControl2("09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1")
                              
        terminal.HostAddress = "demo:ibm3270.sim"
        Set view = frame.CreateView(terminal)
        
        'Get data from InfoConnect or perform other commands
        app.Wait (3000)
        
        'Close InfoConnect without saving the session
        app.Close ApplicationCloseOption_CloseNoSave
        
    End Sub
    See Also