VBA Not Waiting for Attachmate (OIA.XStatus)
VBA Not Waiting for Attachmate (OIA.XStatus)
(OP)
Long time reader, first time poster:
I've inherited a complex project that involves Excel/VBA interfacing with Attachmate EXTRA! X-treme 8.0. My knowledge of EXTRA is about an inch above nothing; however, I know enough that EXTRA needs some built-in pauses to wait for the clock to reach zero occasionally. The person who built the code wrote a clever function that looks to pause after each instance of Clear or Enter or similar:
And although it is pausing, it's not pausing long enough or in the right places. Can someone take a look at the code and tell me if it should work? I'd be happy to post more code if that would help. At this time, I'm trying to compare a number from an Excel report with the number in EXTRA, if they match it outputs "match" to the report; if they don't match it outputs whatever is in EXTRA. It works some time but invariably skips rows and outputs errors occasionally.
I've inherited a complex project that involves Excel/VBA interfacing with Attachmate EXTRA! X-treme 8.0. My knowledge of EXTRA is about an inch above nothing; however, I know enough that EXTRA needs some built-in pauses to wait for the clock to reach zero occasionally. The person who built the code wrote a clever function that looks to pause after each instance of Clear or Enter or similar:
CODE --> VBA
Option Base 1 Option Explicit Dim objExtraSystem As ExtraSystem Dim objExtraSessions As ExtraSessions Dim objExtraSession As ExtraSession Dim objExtraScreen As ExtraScreen Dim objExtraArea As ExtraArea Dim objExtraSerialSetup As ExtraConnectivity Enum sKey sKey_Clear = 0 sKey_Enter sKey_PF1 sKey_PF3 sKey_PF5 sKey_POR End Enum Function FuncKey(FuncVal As sKey, Optional sRepeat& = 1) On Error GoTo ErrHnd Application.EnableCancelKey = xlErrorHandler Dim StrSND$, strTimer, i& With objExtraScreen Select Case FuncVal Case 0: StrSND$ = "<Clear>" Case 1: StrSND$ = "<Enter>" Case 2: StrSND$ = "<PF1>" Case 3: StrSND$ = "<PF3>" Case 4: StrSND$ = "<PF5>" Case 5: StrSND$ = "<POR>" End Select For i = 1 To sRepeat Dim sTimer sTimer = Timer If Not FuncVal = 5 Then Do Until objExtraScreen.OIA.XStatus = 0 And objExtraScreen.OIA.ErrorStatus = 0: Loop .SendKeys StrSND$ Do Until objExtraScreen.OIA.XStatus = 0 And objExtraScreen.OIA.ErrorStatus = 0: Loop If FuncVal = 1 Then Do Until Not objExtraScreen.GetString(1, 1, 33) = "** EMPLOYEE POLICY NOT ALLOWED **" _ And Not objExtraScreen.GetString(1, 2, 30) = "COMMAND SUCCESSFULLY COMPLETED": Loop End If Do While objExtraScreen.OIA.XStatus <> 0: Loop If FuncVal = 5 Then Do Until Trim(objExtraScreen.GetString(21, 9, 43)) = "Enter the sign-on for your application ===>": Loop Next End With ErrExit: Exit Function ErrHnd: If Err = 18 Then End Else MsgBox Err.Number & ": " & Err.Description Resume ErrExit End If End Function
And although it is pausing, it's not pausing long enough or in the right places. Can someone take a look at the code and tell me if it should work? I'd be happy to post more code if that would help. At this time, I'm trying to compare a number from an Excel report with the number in EXTRA, if they match it outputs "match" to the report; if they don't match it outputs whatever is in EXTRA. It works some time but invariably skips rows and outputs errors occasionally.
RE: VBA Not Waiting for Attachmate (OIA.XStatus)
You never call this function, so how could it do anything for you.
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: VBA Not Waiting for Attachmate (OIA.XStatus)
CODE --> VBA
RE: VBA Not Waiting for Attachmate (OIA.XStatus)
CODE
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: VBA Not Waiting for Attachmate (OIA.XStatus)
RE: VBA Not Waiting for Attachmate (OIA.XStatus)
Ah, I do see that in my reference.
This is the problem with looking at snippets of code: It cannot be tested cuz its incomlpete.
I use Attachmate Extra, and with Attachmate Extra there is no Extra application object as you seem to assign to DEM. SendKeys is a function of a SCREEN, which is an object in a SESSION, which is an object in an Extra SYSTEM...
CODE
I'd suggest that you STEP thru your code and OBSERVE [highlight]the value[/[highlight]] that the FuncKey function is setting.
Skip,
Just traded in my old subtlety...
for a NUANCE!