Function with Embedded String

GlennL

New Member
Joined
Sep 25, 2018
Messages
37
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello,

I am passing data between Excel and SAP.

I have this:
OperationPrint = session.findById("wnd[1]/usr/tblSAPLCOIHTCTRL_5000/txtRIPRT1-VORNR[1,0]").Text​

which works fine. However I need to loop the row number (LineNumber). This is the code I created:

OPLineText = Chr(34) & "wnd[1]/usr/tblSAPLCOIHTCTRL_5000/txtRIPRT1-VORNR[1," & LineNumber & "]" & Chr(34) & ").Text"
PrintLine = session.findById(OpLineText).Text​

The challenge I have is VBA errors when it hits the PrintLine code (Run-time error '619': The control could not be found by id.)

How do I get this code to run?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello,

I am passing data between Excel and SAP.

I have this:
OperationPrint = session.findById("wnd[1]/usr/tblSAPLCOIHTCTRL_5000/txtRIPRT1-VORNR[1,0]").Text​

which works fine. However I need to loop the row number (LineNumber). This is the code I created:

OPLineText = Chr(34) & "wnd[1]/usr/tblSAPLCOIHTCTRL_5000/txtRIPRT1-VORNR[1," & LineNumber & "]" & Chr(34) & ").Text"
PrintLine = session.findById(OpLineText).Text​

The challenge I have is VBA errors when it hits the PrintLine code (Run-time error '619': The control could not be found by id.)

How do I get this code to run?

There was a slight error in the code above. However the same error is still happening with this new code:

Code:
OpLineText = Chr(34) & "wnd[1]/usr/tblSAPLCOIHTCTRL_5000/txtRIPRT1-VORNR[1," & LineNumber & "]" & Chr(34)
PrintLine = session.findById(OpLineText).Text
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top