in

PCOMM Not Working In VBA All The Time

The following VBA code uses the sendkeys method of a PCOMM class to send the text "123" to the AS400 User Interface from Word 2003 Standard Edition, but it does not work in Word 2002 or Word 2003 Professional Edition.  If I remember correctly when I used early binding I got the error message "ECL37100: Emulator Interface (EHLLAPI) error.  Reason Code: 9" and with late binding as in the code below I don't get an error, but the sendkeys text does not appear in AS400.  It appears as though Word 2002 and Word 2003 Professional Edition have some issues with PCOMM classes that try to write to the AS400 user interface, but Word 2003 Standard Edition works fine both reading and writing to the AS400 User Interface with PCOMM classes.

Sub autECLPSTest()
Dim autECLPSObj As Object
Dim autECLConnList As Object
Set autECLPSObj = CreateObject("PCOMM.autECLPS")
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
' Initialize the connection
autECLConnList.Refresh
autECLPSObj.SetConnectionByHandle (autECLConnList(1).Handle)
autECLPSObj.SendKeys "123"
End Sub

To further prove my point the following gettext method works in Word 2002, Word 2003 Standard and Professional Editions while the subsequent settext code only works in the Word 2003 Standard Edition.

Gettext Example:

Dim  autECLPSObj as Object
Dim  PSText as String
 
' Initialize the connection
Set autECLPSObj = CreateObject("PCOMM.autECLPS")
autECLPSObj.SetConnectionByName("A")
 
PSText = autECLPSObj.GetText(2,1,50)


Settext Example:

Dim autECLPSObj as Object
 
'Initialize the connection
Set autECLPSObj = CreateObject("PCOMM.autECLPS")
autECLPSObj.SetConnectionByName("A")
autECLPSObj.SetText"IBM is great", 2, 1


I need to have read and write functionality using PCOMM classes with Word 2002 and Word 2003 Professional Edition like I have with Word 2003 Standard Edition.  Any help would be appreciated.  Thank you
Movie Stars

Solution: PCOMM Not Working In VBA All The Time

Mitch,

If you get all upgraded and patched up and still have problems, post back and we can take a closer look.

- Gary