I'm struggling with a problem involving a macro that connects with PCOMM 6.0. My computer uses Windows 7 and Excel 2007. The code I'm trying to run is:
This is almost verbatim from the documentation here, but it causes excel to hang. The problem appears to be using the SendKeys. I've also tried to use the SetKeys with similar results. Other examples in the documentation seem to work fine. I'm able to move the cursor and identify the fields that are visible on the PCOMM screen. But any attempt I make to actually input data to PCOMM via vba cause vba and excel to hang. I'm relatively new to writing macros to interact with PCOMM and just wondering if anyone has any experience that might be able to shed some light on what I might be doing wrong? Thanks!
Code:
Dim NumFields As LongDim 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.SetCursorPos 19, 43
autECLPSObj.SendKeys "username"
This is almost verbatim from the documentation here, but it causes excel to hang. The problem appears to be using the SendKeys. I've also tried to use the SetKeys with similar results. Other examples in the documentation seem to work fine. I'm able to move the cursor and identify the fields that are visible on the PCOMM screen. But any attempt I make to actually input data to PCOMM via vba cause vba and excel to hang. I'm relatively new to writing macros to interact with PCOMM and just wondering if anyone has any experience that might be able to shed some light on what I might be doing wrong? Thanks!