Users input a plant number in a Excel worksheet cell (J2) as indicated below. I have set a dimension to pick data from this cell and input it into a SAP transaction.
My VBA code is the following.
' Copy in the plant number
session.findById("wnd[0]/usr/ctxtIWERK-LOW").Text = "2004"
session.findById("wnd[0]/usr/ctxtIWERK-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtIWERK-LOW").caretPosition = 4
session.findById("wnd[0]/usr/btn%_REVNR_%_APP_%-VALU_PUSH").press
This works fine. The problem start when I change the "2004" plant number to reflect the dimension criteria to enable to read the input cell (J2) value. No input from (J2) is transferred to the SAP transaction.
I have change the above code to the following code:-
' Copy in the plant number
session.findById("wnd[0]/usr/ctxtIWERK-LOW").Text = selectedSite
session.findById("wnd[0]/usr/ctxtIWERK-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtIWERK-LOW").caretPosition = 4
session.findById("wnd[0]/usr/btn%_REVNR_%_APP_%-VALU_PUSH").press
I declare the point of pickup (J2) as per below.
Dim selectedSite As String
selectedSite = ActiveWorkbook.ActiveSheet.Range("J2").Value
What am I doing wrong? Any help is appreciated.
FWK
My VBA code is the following.
' Copy in the plant number
session.findById("wnd[0]/usr/ctxtIWERK-LOW").Text = "2004"
session.findById("wnd[0]/usr/ctxtIWERK-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtIWERK-LOW").caretPosition = 4
session.findById("wnd[0]/usr/btn%_REVNR_%_APP_%-VALU_PUSH").press
This works fine. The problem start when I change the "2004" plant number to reflect the dimension criteria to enable to read the input cell (J2) value. No input from (J2) is transferred to the SAP transaction.
I have change the above code to the following code:-
' Copy in the plant number
session.findById("wnd[0]/usr/ctxtIWERK-LOW").Text = selectedSite
session.findById("wnd[0]/usr/ctxtIWERK-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtIWERK-LOW").caretPosition = 4
session.findById("wnd[0]/usr/btn%_REVNR_%_APP_%-VALU_PUSH").press
I declare the point of pickup (J2) as per below.
Dim selectedSite As String
selectedSite = ActiveWorkbook.ActiveSheet.Range("J2").Value
What am I doing wrong? Any help is appreciated.
FWK