Understanding Syntax

Every keyword Help topic includes a syntax line that defines the syntax rules for that keyword. Following are some guidelines for understanding and using correct command syntax in your Visual Basic macros:

  • Keywords and arguments are not case sensitive. You can use uppercase or lowercase text.
  • Use square brackets ([ ]) to indicate that an argument is optional.
  • Use items shown in command language (that is, plain text — not italic) exactly as they appear in the syntax statement.
  • Italic words indicate placeholders for variable names, text, or values that you should supply.
  • Use arguments (except for named arguments) in the order shown in the syntax statement.
  • Enclose literal string arguments in quotation marks. (String variables don't require quotation marks.)
  • For strings that appear within other strings, use double quotation marks; for example:
    ThisScreen.SomeMethod ("Say ""Hello"" to Jon")
  • Precede InfoConnect methods or properties with the InfoConnect object and a period. Or, use a With statement to identify the object.

The method and property signatures displayed in the InfoConnect VBA reference section typically refer to an object. For example:

object.GetText 

The syntax you use to reference the object in this signature depends on whether you are calling the method from an InfoConnect macro, a session created at runtime, or a macro developed in another application, like Excel.

Let's take a look at how to use the syntax displayed in the Help for the GetText method.

The InfoConnect VBA Help displays the following syntax for the GetText method:

We can see at the top of the Help that this method is a member of the IbmScreen object so this is the type of object in the signature (displayed as object.GetText under Syntax).

It's a good idea to verify this membership by looking at the member list for the object.


 If you are developing a macro for this session, you can use the ThisIbmScreen property to get this object.

The syntax for using GetText in a session
Copy Code
'You can reference this object directly 
Debug.Print ThisIbmScreen.GetText(1, 1, 50)

'You can also reference it using a With statement
With ThisIbmScreen
    .GetText(1,1,50)
End With

    

If you are developing a macro for a session that you create at runtime or a macro created from another application like Excel, you'll need to do a little more work to get the screen object before you call GetText.

The syntax for using GetText in a session created at runtime
Copy Code
Private Sub CreateReflectionIBMSession()
  Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
  
  'Declare frame, terminal, and view object variables:
  Dim frame As Attachmate_Reflection_Objects.frame
  Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
  Dim view As Attachmate_Reflection_Objects.view
  Dim screen As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
      
  'Create New instance of InfoConnect   Set app = New Attachmate_Reflection_Objects_Framework.ApplicationObject
  
  With app
    'Wait until the InfoConnect is initalized
     Do While .IsInitialized = False
       .Wait 200
     Loop
      
     'Get a handle to the frame
     Set frame = .GetObject("Frame")
      
     'Make the frame visible so we can view the workspace
     frame.Visible = True
  End With
                        
  'Create an Ibm3270 control and set the host address
  Set terminal = app.CreateControl2("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}")
  terminal.HostAddress = "demo:ibm3270.sim"
  Set view = frame.CreateView(terminal)
  'Get the IbmScreen object
  Set screen = terminal.screen
  Debug.Print screen.GetText(1, 1, 50)
  '.........

End Sub 

  

The InfoConnect VBA Help displays the following syntax for the GetText method:

               

We can see at the top of the Help that this method is a member of the Screen object so this is the type of object in the signature (displayed as object.GetText under Syntax).

Note: It's a good idea to verify this membership by looking at the member list for the object.

 If you are developing a macro for this session, you can use the ThisScreen property to get this object.

The syntax for using GetText in a session
Copy Code
'You can reference this object directly 
Debug.Print ThisScreen.GetText(1, 1, 50)

'You can also reference it using a With statement
With ThisScreen
    .GetText(1,1,50)
End With
               

If you are developing a macro for a session that you create at runtime or a macro created from another application like Excel, you'll need to do a little more work to get the screen object before you call GetText. 

The syntax for using GetText in a session created at runtime
Copy Code
 Private Sub CreateReflectionOSSession()
    Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
   
    'Declare frame, terminal, and view object variables:
    Dim frame As Attachmate_Reflection_Objects.frame
    Dim terminal As Attachmate_Reflection_Objects_Emulation_OpenSystems.terminal
    Dim view As Attachmate_Reflection_Objects.view
    Dim screen As Attachmate_Reflection_Objects_Emulation_OpenSystems.screen
     
    'Create New instance of InfoConnect     Set app = New Attachmate_Reflection_Objects_Framework.ApplicationObject
 
    With app
         'Wait until InfoConnect is initalized
         Do While .IsInitialized = False
             .Wait 200
         Loop
     
         'Get a handle to the frame
         Set frame = .GetObject("Frame")
     
         'Make the frame visible so we can view the workspace
         frame.Visible = True
     
     End With
                       
     'Create an Open Systems control and set the host address
     Set terminal = app.CreateControl2("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}")
     terminal.ConnectionSettingsTelnet.HostAddress = "yourHostName"
     Set view = frame.CreateView(terminal)
     'Get the IbmScreen object
     Set screen = terminal.screen
     Debug.Print screen.GetText(1, 1, 50)
     '.........
End Sub