Excel VBA and IBM Emulator ActiveX Error

MCTampa

Board Regular
Joined
Apr 14, 2016
Messages
97
Hello,

I am trying to use a macro that was designed by a former colleague.
It is a rather standard macro to automate data input into an IBM Emulator.

Below is the script (the creator was French):
The error is occurring at the MySession.SetConnectionByName (SessionName) line.
The macro references Cell coordinates 4,3 in which I have an A.

The message I receive is "Run-time error '429': ActiveX component can't create object.
However after a good deal of searching around, I cannot figure out what the issue is.

Code:
Private Sub BtnSEND_Click()

Dim i, j As Integer
Dim MySession As New AutSess
Dim OIA As New AutOIA
Dim PS As New AutPS
Dim DerLigne, Ligne1 As Integer
Dim DerCol, Col1 As Integer
Dim SessionName As String
Dim NbCaract As Integer
Const NumLigneAction = 7 'Numéro de la ligne Action
Const NumLigneRow = 8 'Numéro de la ligne Row
Const NumLigneCol = 9 'Numéro de la ligne Col
'Récupération du périmétre à traiter
Ligne1 = Cells(2, 3).Value
Col1 = Cells(2, 6).Value
DerLigne = Cells(3, 3).Value
DerCol = Cells(3, 6).Value
'Récupération du nom de la session
SessionName = CStr(Cells(4, 3).Value)

'Connection à la session de la NA
MySession.SetConnectionByName (SessionName)
Set OIA = MySession.autECLOIA
Set PS = MySession.autECLPS

'Boucle sur le nb de ligne
For i = Ligne1 To DerLigne
    OIA.WaitForAppAvailable
    OIA.WaitForInputReady
    'Boucle sur les colonnes
    For j = Col1 To DerCol
        Select Case UCase(Cells(NumLigneAction, j).Value)
        'pour inscrire la donnée dans la NA
        Case "PUT"
            If Cells(i, j).Value <> "" Then
                PS.SendKeys Cells(i, j).Value, Cells(NumLigneRow, j).Value, Cells(NumLigneCol, j).Value
                OIA.WaitForInputReady
            End If
        'Pour lancer une commande NA, par exemple ENTER ou PF2
        Case "COM"
            If Cells(i, j).Value <> "" Then
                PS.SendKeys ("[" & UCase(CStr(Cells(i, j).Value)) & "]")
                OIA.WaitForInputReady
                PS.WaitForAttrib 1, 2, "00", "3c", 3, 2000
                PS.WaitForCursor 1, 3, 2000
            End If
        'Mettre une zone à blanc
        Case "BLANK"
            If Cells(i, j).Value <> "" Then
                PS.SendKeys String(Cells(i, j).Value, " "), Cells(NumLigneRow, j).Value, Cells(NumLigneCol, j).Value
                OIA.WaitForInputReady
            End If
        'Pour récupérer une donnée sur la NA dans le fichier Excel
        Case Else
            NbCaract = CInt(Mid$(Cells(NumLigneAction, j).Value, 4, 2))
            Cells(i, j).Value = PS.GetText(Cells(NumLigneRow, j).Value, Cells(NumLigneCol, j).Value, NbCaract)
        End Select
    Next j
Next i
PS.WaitForAttrib 1, 2, "00", "3c", 3, 2000
PS.WaitForCursor 1, 3, 2000
Set OIA = Nothing
Set PS = Nothing
End Sub
 
Last edited by a moderator:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
As a follow up, I have the following References checked in VBA Project (in the below order):
Visual Basic for Applications
Microsoft Excel 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Form 2.0 Object Library
PCOMM autECLOIA Automation Object 1.0 Library
PCOMM autECLPS Automation Object 1.0 Library
PCOMM autECLSession Automation Object 1.0 Library
Microsoft ActiveX Data Objects (Multi-dimensional) 6.0 Library
Microsoft ActiveX Data Objects Recordset 6.0 Library
PCOMM Emulator Settings Automation Objects 1.0 Library

Am I missing anything? Should I be using an older version of anything?
 
Upvote 0
Hi MCTampa,
this is the piece of code I use to dim objects and to set them. I think it will be easy for you to customize it.

Code:
Dim eclps As Object, ecloia As Object
Set eclps = CreateObject("PCOMM.autECLPS")
Set ecloia = CreateObject("Pcomm.autecloia")
eclps.SetConnectionByName ("A")
ecloia.SetConnectionByName ("A")

Hope this helps and have a nice weekend.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top