title: How to connect VBA with a Rumba 3270 emulator
body: <p>I have come to the knowledge that to connect to Rumba 3270 mainframe I need to incorporate </p>
  
  <p><code>"Ehlapi32.DLL</code>"</p>
  
  <p>However when I googled around I found a ton of functions which I not sure how to use. I have the following code to connect, but its returning connection error.</p>
  
  <pre><code>Sub fConnect()
      nRT = 0
      Call hllapi(1, ByVal "A", 0, nRT)
  
      If nRT &lt;&gt; 0 Then 'if not made connection display a Error
              MsgBox "Connection Error. Try again"
      Else
              strConectado = True
      End If
  End Sub
  </code></pre>
  
  <p>Below is the hllapi function</p>
  
  <pre><code>Declare Function hllapi Lib "C:\Program Files\NetManage\System\Ehlapi32.DLL" (Func As Integer, ByVal lpszData As String, Length As Integer, Value As Integer) As Integer
  Declare Function OSGetPrivateProfileString% Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
  ' HLLAPI FUNCTION DECLARATIONS
  
  Public nRT
  Public strConectado As Boolean
  
  Public Enum ImpulseKeyEnum
      ike_enter = 0
      ike_f1 = 1
      ike_F2 = 2
      IKE_F3 = 3
      ike_F4 = 4
      ike_F5 = 5
      ike_F6 = 6
      ike_F7 = 7
      ike_F8 = 8
      ike_F9 = 9
      ike_F10 = 10
      ike_F11 = 11
      ike_F12 = 12
      ike_F13 = 13
      ike_BackTab = 93
      ike_Left = 94
      ike_right = 95
      ike_UP = 96
      ike_Down = 97
      ike_Tab = 98
      ike_clearfield = 99
      ike_Attention = 100
  End Enum
  
  Public Enum PositionSearch
      ika_right = 1
      ika_Left = 2
  End Enum
  </code></pre>
  
  <p>When I run the program with RUMBA open using F8 key, it shows error, The "nRT" variable is getting set as "1" instead of "0".</p>