VBA Execute UniBasic


  Dim objSession As Object
  Dim objFile As Object
  Const UVE_NOERROR = 0
  Const NETWORK_TCP = 2
  Const NETWORK_LANMAN = 1
  Const NETWORK_DEFAULT = 0
  Const UV_SESSION_OBJECT = "UniObjects.unioaifctrl"

  Set objSession = CreateObject(UV_SESSION_OBJECT)
  If objSession Is Nothing Then
    MsgBox "UniData Session not created."
    Exit Sub
  End If
  objSession.UserName = "myusername"
  objSession.Password = "thepassword"
  objSession.AccountPath = "theaccount"
  objSession.HostName = "hostname"

  objSession.Transport = NETWORK_LANMAN

  objSession.Connect
  If objSession.IsActive Then

    If objSession.HostType = UVT_UNIX Then
      MsgBox "You are connected to a UNIX server"
    End If
    
    Dim GetOrderData As Object
    Set GetOrderData = objSession.Subroutine("C21.GET.RECORD", 3)
    GetOrderData.SetArg 0, txtFile.Text
    GetOrderData.SetArg 1, txtRecord.Text
    GetOrderData.call
    vRecordOut = GetOrderData.GetArg(2)
    Label1.Caption = GetOrderData.GetArg(2)
    objSession.Disconnect
  Else
    If objSession.Error <> UVE_NOERROR Then
      MsgBox "Unable to open connection:- " & objSession.Error
    End If
  End If
End Sub


Hosted by www.Geocities.ws

1