Attachmate Worldwide  |   Contact Us  |   NetIQ.com
Home » Support » Solution Library

Technical Notes

Executing Host-Initiated Reflection Basic Commands Through VBA
Technical Note 2148
Last Reviewed 26-Oct-2006
Applies To
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 further assistance, please contact technical support. For information about contacting Attachmate support, see http://support.attachmate.com/contact/?prod=reflection.

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

Did this technical note answer your question?

Yes    No    Somewhat     Not sure yet

Additional comments about this tech note:

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