Open a Session From a Microsoft Excel Macro
In This Topic
You can open an InfoConnect session from another application that supports VBA.
Visual Basic uses a standard set of protocols called Automation (or OLE Automation) that allows one application to communicate with other applications. Any application that supports Automation can communicate with any other application. This means that an InfoConnect session can communicate with other InfoConnect sessions, Microsoft Office products, stand-alone Visual Basic, or any other product that supports Automation.
This example shows how to open an InfoConnect session document from an Excel macro.
If you prefer to run macros in pre-configured sessions instead of creating your own sessions, you can download the VBA Sample Sessions and open the open-ibm-session-from-excel.xlsm (IBM) and open-os-session-from-excel.xlsm (Open Systems) files. The download package contains everything you need to run the macros in these files. See Download the VBA Sample Sessions.
Open an InfoConnect session from an Excel Macro
- In InfoConnect, create a session and save it as "mySavedSession" in your ...\Documents\Micro Focus\InfoConnect\" folder.
- In a Microsoft Excel worksheet, open the Visual Basic Editor and insert a new code module.
- On the Excel VBA Editor Tools menu, select References and then select the following InfoConnect Libraries:
- Attachmate_Reflection_Objects
- Attachmate_Reflection_Objects_Emulation_IbmHosts (if you want to open an IBM session)
- Attachmate_Reflection_Objects_Emulation_OpenSystems (if you want to open an Open Systems session)
- Attachmate_Reflection_Objects_Framework
- Copy the following code into the VBA Editor and press F5 to run it.
Concepts
To open a session from another application, you'll need to use the InfoConnect ApplicationObject, IbmTerminal or Terminal, Frame, and View objects:
- The ApplicationObject is the InfoConnect application.
- The Frame object is the top-level user interface component for the workspace and it can be used to control the display of the workspace and to create views for the terminal controls running in the workspace.
- The IbmTerminal (or Terminal) object is the top level control for the new session. The CreateControl method returns the appropriate terminal control for the session document file that you pass to it.
- The View object represents the user interface aspect of the new session. To display the session, we need to create a View Object for the terminal and we do this using the Frame object.
For more about these objects, see Using the InfoConnect Object Model.
See Also