0
votes

My script is working however there is one field I can't figure out how to change in the VBA script. I need to change it based on an entry in Excel.

Here is the script where I am experiencing the issue, the value I have bolded (4).

I've tested when changing the value manually and it works. But what I need is to change the value (4) to different values based on data in the excel file.

Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB").getAbsoluteRow(4).Selected = False Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPS-POSNR[0,4]").SetFocus Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPS-POSNR[0,4]").caretPosition = 0

Example: If Excel file says "20" in column G, then change above (4) to (1) So simply put, replace the value in the script based on excel value.

1

1 Answers

0
votes

Yes, of course, you need a case statement. I'd do it like this:

Select Case value = test_condition

   Case condition_1
      rowResult = 1

   Case condition_2
      rowResult = 2

   ...

   Case condition_n
      result_n

 [ Case Else
      result_else ]

End Select

Then SAP code would be:

Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB").getAbsoluteRow(rowResult).Selected = False
Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPS-POSNR[0," & CStr(rowResult) & "]").SetFocus
Session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPS-POSNR[0," & CStr(rowResult) & "]").caretPosition = 0