sap gui - Can a VBA script read SAP GUI errors? -


i'm not hopeful, i'm wondering if there way vba script identify error being thrown sap gui. example, if transaction locked user.
currently, if error pops up, script thinks nothing of it, , continues next line (which errs because whatever button i'm having press doesn't exist yet). if possible, i'd identify error before next line, user can fix it.

in cases, if done workarounds i'll have script assume error, coupled on error resume next makes me cringe, , doesn't work situations.

example:

for each cell in range("d:d")     if cell.value = "" exit     session.findbyid("wnd[1]/usr/tblsaplczditctrl_4010/ctxtmapl-matnr[2," & 4 & "]").text = cell.value     session.findbyid("wnd[1]/usr/tblsaplczditctrl_4010/txtmapl-plnal[0," & 4 & "]").text = groupctr     session.findbyid("wnd[1]/usr/tblsaplczditctrl_4010/ctxtmapl-werks[3," & 4 & "]").text = plant     session.findbyid("wnd[1]/usr/tblsaplczditctrl_4010").verticalscrollbar.position = + 1 'if duplicate entry found, sap message box pops up. script closes message box. if no message box pops up, 'the script errors when trying close it. therefore, "error" means item sucesfully added.     on error resume next     session.findbyid("wnd[2]/tbar[0]/btn[0]").press next cell 

for clarity, i'm trying like:

on error goto errhndl '...my code... exit sub  errhdnl:     select case saperrcode         case [excode1]              'do things error type         case [excode2]              'do different things error type 


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -