Executing Host-Initiated Reflection Basic Commands through VBA

  • 7021486
  • 26-Oct-2006
  • 01-Apr-2018

Environment

Reflection 2014
Reflection for UNIX and OpenVMS 2014
Reflection for UNIX and OpenVMS 2011
Reflection Standard Suite 2011
Reflection for HP, UNIX and OpenVMS version 14.0 SP1 or higher

Situation

Beginning with Reflection version 14.0 Service Pack 1 (SP1), Reflection products can execute Reflection Basic (RB) host-initiated commands using Microsoft Visual Basic for Applications (VBA) with minimal modification to the command scripts.

Note: See Technical Notes 1223 and 1279 for more information about host-initiated commands.

Resolution

Known Issues with Host-Initiated Reflection Basic Commands

Executing host-initiated Reflection Basic commands through VBA can resolve two known issues that occur after previous execution of a Reflection Basic script (.RBS file):

  • Host-initiated Reflection Basic commands fail to launch another application using the CreateObject method.
  • Or, do not return from the GetSaveAsFileName method.

Using VBA to Execute RB Commands—Script Modifications

There are two ways that Reflection can be instructed to execute Reflection Basic commands using VBA—by adding a special comment at the beginning of the Reflection Basic command, or by using a new escape sequence.

Adding a Special Comment to the Reflection Basic Command

Add the following as a comment to the beginning of the host-initiated commands: RunAsVBA

HP Emulation Example

<ESC>&o1G
‘RunAsVBA
Sub Main
    Dim c As Integer
    c = Val(InputBox$("Enter the sales amount:"))
    MsgBox "Your commission is: " & c
End Sub<ESC>&oH

VT Emulation Example

<DCS>2000;1{ 
‘RunAsVBA
Sub Main
    Dim c As Integer
    c = Val(InputBox$("Enter the sales amount:"))
    MsgBox "Your commission is: " & DisplayCommission(c)
End Sub <ST>

Using a New Escape Sequence

The syntax for using a new escape sequence varies depending on whether you are using HP or VT emulation.

HP Emulation Syntax

<ESC>&o<tag>t<term>G<RB script><ESC>&oI

Example

<ESC>&o1GSub Main
    Dim c As Integer
    c = Val(InputBox$("Enter the sales amount:"))
    MsgBox "Your commission is: " & c
End Sub<ESC>&oI

VT Emulation Syntax

<DCS>2001;<term>;<tag>{<commands><ST>

Example

<DCS>2001;1{ Sub Main
    Dim c As Integer
    c = Val(InputBox$("Enter the sales amount:"))
    MsgBox "Your commission is: " & DisplayCommission(c)
End Sub <ST>

Note: All other aspects of command execution are the same as previously.

Additional Information

Legacy KB ID

This document was originally published as Attachmate Technical Note 2148.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.