This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

excel 365 32bit VBA to Rumba 10.1

Greetings!

I am a beginner here.  I have searched the website best I can, but I have not found anything as specific as I really need it.

I'm not certain which references I need to check off to make a connection, and I'm not certain of a good template of VBA code to initiate that connection.

My goal is simply to take strings from RUMBA and value them to cells in excel, and vice versa.

I'd also like to send keystrokes to RUMBA using my excel VBA macro.

I typically perform tasks with multiple RUMBA sessions open (let's say API session A, API session B, API session C, and API session D)

How do I ensure my VBA macro is communicating with a specified session?

Labels:

Rumba
  • 0  

    Hi Timothy,

    starting with version 10.2 RUMBA provides integrated VBA Support.
    It makes it even easier to create macros using Microsoft Visual Basic for Applications.

    You may want to record a macro and save it as VBA. Rumba will generate the VBA code for you.
    It’s a QuickStart to see working code snippets

     

    Working in Rumba+

    Basic operations using RumbaEmulationSessionObject

    The RumbaEmulationSessionObject is used to access and handle multiple host session tasks such as:

    • Connecting
    • Typing
    • Retrieving screen text
    • Executing navigation sequences.

    For a full list of RumbaEmulationSessionObject methods, properties and events, see the VBA Editor Help.

     

    Creating a RumbaEmulationSessionObject instance

    1. Open a mainframe session in Rumba+.

    A Session1 (Mainframe Display) object is created in the project under Rumba Objects.
    This object is a RumbaEmulationSessionObject, which means you can access all of its methods and properties.

     

    1. Double-click the object.
    2. Type Me.

    When you press the period ( . ) key, a list appears showing the available methods and properties for RumbaEmulationSessionObject.

     

    Connection

    This example shows how to establish a connection, setting the host name, port, then connecting:

    Sub SetConnection()
     HostName = "yourMainframe"
     Port = 2023
     Connect
    End Sub

     

    Simple navigation

    After the connection is made, you can perform some navigation steps: such as setting the cursor position, typing text, sending emulation keys, and waiting for a screen to arrive:

    Sub NavigateToTele()
     WaitScreen Me, "Application:", SearchOnlyAt, False,
     DefaultConnectionTimeout, 3, 2, 3, 15
     SetCursorPosition 25, 7
     TypeText "cics"
     SendKey "Enter"
     WaitScreenTimeout Me, DefaultScreenTimeout
     SendKey "Clear"
     WaitScreenTimeout Me, DefaultScreenTimeout
     SendKey "Tab"
     TypeText "tele"
     SendKey "Enter"
     WaitScreen Me, "Account Number : ", SearchOnlyAt, False,
     DefaultScreenDataTimeout, 6, 26, 6, 44
    End Sub

    Basic Operations Using RumbaApplicationObject

    Use RumbaApplicationObject to access and handle multiple emulation sessions (Rumba+ tabs).
    For a full list of RumbaApplicationObject methods, properties and events, see the VBA Editor Help.

    Opening a session

    When working in the VBA Editor launched from Rumba+, you have access to RumbaApplicationObject.

    For example, to open a new Mainframe session:

    ...
    Application.CreateSession RumbaSessionType_ MainFrameDisplay
    
    ...

    or, to open a saved session profile:

    ...
    
    Application.OpenSessionProfile "C:\work\myRumbaSession.rsdm"
    
    ...
    

    Getting the active session

    Getting the active session for further work

    ...
    
    Dim RumbaActiveSession As RumbaEmulationSessionObject
    
    Set RumbaActiveSession = Application.GetSession(Application.ActiveSessionID)
    
    ' further work with the session object
    
    RumbaActiveSession.Connect
    
    ...

    Getting a session by its tab name

    ...
    
    Dim RumbaActiveSession As RumbaEmulationSessionObject
    
    Set RumbaActiveSession = Application.GetSessionByName("MF1")
    
    ' further work with the session object
    
    RumbaActiveSession.Connect
    
    ...

    Getting a session by its tab index

    ...
    
    Dim RumbaActiveSession As RumbaEmulationSessionObject
    
    Set RumbaActiveSession = Application.GetSession (2)
    
    ' further work with the session object
    
    RumbaActiveSession.Connect
    
    ...
    
     

     

     

    Working with External Applications

    This section describes how to create VBA macros in external applications such as Microsoft Excel.

    Setting up your environment

    Referencing the Rumba+ Automation Objects Library

    1. From the VBA Editor menu bar, select Tools > References.The References windowappears.
    2. Check Rumba Automation Objects Library from the Available References list.
    3. Click OK.

    Adding RumbaGlobals and ReflectionLegacySession

    To add RumbaGlobals and ReflectionLegacySession, you must first export them from the Rumba+ VBA Editor, then import them into the Microsoft VBA Editor.

    1. Open the VBA Editor from Rumba+: Select Tools > New Macro > VBA.
    2. In the Project explorer, expand the Modules list, right-click RumbaGlobals and select Export File

         from the pop-up menu.

    1. Save the file.
    2. In the Project explorer, expand the Class Modules list, right-click ReflectionLegacySession and

         select Export File from the pop-up menu.

    1. Save the file.
    2. Close this instance of the VBA editor.
    3. Open the VBA Editor from Excel or another Office program: Select Developer tab > Code group >

    Visual Basic.

    Note: If the Developer tab is not visible, you can enable it:

    1. Select File > Options > Customize Ribbon
    2. Under Customize the Ribbon and Main Tabs, check Developer.
    3. Click OK.
    4. In the VBA Editor, select File > Import File
    5. Select RumbaGlobals.bas.

    10.Click OK.

    11.In the VBA Editor, select File > Import File

    12.Select ReflectionLegacySession.cls.

    13.Click OK.

     

    Launching Rumba+ and creating a session

    The following example launches Rumba+, creates a new mainframe session, sets some connection

    settings, then connects to the specified host:

    Sub RunRumba()
    
     Dim App As RumbaApplicationObject
    
     Dim Emul As RumbaEmulationSessionObject
    
     Dim SessID As Integer
    
     ' Create Rumba Application object:
    
     Set App = CreateObject("MicroFocus.Rumba")
    
     'Create Mainframe Display session:
    
     SessID = App.CreateSession(RumbaSessionType_MainFrameDisplay)
    
     ' Get Emulation Session object:
    
     Set Emul = App.GetSession(SessID)
    
     ' Set connection parameters and connect:
    
     Emul.HostName = "YourHostName"
    
     Emul.Port = 23
    
     Emul.Connect
    
     End Sub
    
     
     

    Working with an existing instance of Rumba+

    This example searches an existing instance of Rumba+ and, if found, obtains the emulation object:

    Sub UseExistingRumbaSession()
    
     Dim App As RumbaApplicationObject
    
     Dim Emul As RumbaEmulationSessionObject
    
     rumbaDescriptors = RunningRumbaObjectDescriptors
    
      If Len(Join(rumbaDescriptors)) > 0 Then
    
       ' A Rumba instance was found
    
       Set App = GetObject(rumbaDescriptors(LBound(rumbaDescriptors)))
    
       Set Emul = App.GetSession(App.ActiveSessionID)
    
      ' Perform session operations using Emul
    
      End If
    
    End Sub

    The Rumba+ Script Editor is still supported and is part of the Script Engine, a separate application provided alongside Rumba+ to create and modify Rumba+ scripts.
    Sample scripts are provided under RUMBA\System\ScriptEngine\scripts

     hope it helps

  • 0 in reply to   

    Unfortunately, I have Rumba 10.1.  Also in navigating the references in excel, I did not find the one you mentioned.  I did find some ObjectX libraries that were stored in the RUMBA file location.  

  • 0   in reply to 

    If you don't have the folder <RUMBA install folder >\System\ScriptEngine\scripts then you would need to install the ScriptEngine.msi.
    After applying the ScriotEngine.msi you find the sample script."3270 to Excel Basic.csf". This example connects to the VTAM DemoHost, brings up a Mainframe data table, opens a new Excel workbook and transfers the sales totals to Excel.
    This is the next best option to get started with RUMBA scripting.
    If you search the forum, you will find threads about using the ehllapi Interface in Excel or the Objectx libraries

    cheers
    andree