Attachmate Worldwide  |   Contact Us  |   The Attachmate Group
Extend. Manage. Secure. More than 30 years in the business. Over 65,000 customers.

Technical Notes

Executing Host-Initiated Reflection Basic Commands through VBA
Technical Note 2148
Last Reviewed 13-Nov-2008
Applies To
Reflection for UNIX and OpenVMS 2011
Reflection for UNIX and OpenVMS 2008
Reflection Standard Suite 2011
Reflection Standard Suite 2008
Reflection for HP, UNIX and OpenVMS version 14.0 SP1 or higher
Summary

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.

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.

Contact Support

If you need more help, please contact technical support, http://support.attachmate.com/contact/.

Related Technical Notes
1223 How to Send Reflection Commands from the Host
1278 Sending RCL Commands to Reflection from a Host Program
1279 Sending RB Commands from a Host Program
1280 Host Programs that Initiate File Transfers with Reflection

horizontal line

Did this technical note answer your question?

           


Need further help? For technical support, please contact Support.