View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sriram Narayan Sriram Narayan is offline
external usenet poster
 
Posts: 1
Default CAE macro for green screen updates with Excel data

Umm... I was trying to work out how to get a handle to the Excel range
from the PCOMM script.

This is what I've worked out so far:
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
CloseBlanketPO

sub CloseBlanketPO()
Dim oXL, oRange, oCell
Dim curVal, i

autECLSession.autECLPS.autECLFieldList.Refresh
If not autECLSession.autECLPS.autECLFieldList(1).GetText = "PO0110.01"
Then
MsgBox "Please invoke option PO0110 for PO maintenance" & CHR(13) & _
"before triggering this macro."
Exit Sub
End If

On Error Resume Next
Set oXL = GetObject(,"Excel.Application")
If oXL Is Nothing Then
MsgBox "You need to have the Excel list open and the Order list
selected!"
Exit Sub
Else
Set oRange = oXL.Application.Selection
End If
With autECLSession
For each oCell in oRange
curVal = oCell.Value
.autECLOIA.WaitForAppAvailable
.autECLOIA.WaitForInputReady
.autECLPS.SendKeys "B", 13, 48
.autECLPS.SendKeys curVal, 15, 48
.autECLPS.SendKeys "[field+]"
.autECLPS.SendKeys "[pf7]"
.autECLOIA.WaitForInputReady
.autECLPS.SendKeys "Y", 18, 53
.autECLPS.SendKeys "[pf5]"
' If (.autECLOIA.InputInhibited = o Then) _ 'doesn't catch the red X
II
' MsgBox "Blanket Order " & CStr(curVal) & " successfully closed."
Next
End With
End Sub

I'm still up against the problem that I can't trap an error condition
(the little red x in the status line - row 25). The InputInhibited
status apaprently does not reflect this condition. Any tips on that
one?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!