SAP Automation finding specific text

Watchdawg

Board Regular
Joined
Jan 21, 2015
Messages
84
OK, I'm starting to think this can't be accomplished. I have an SAP screen that contains approximately 7 lines of data. Each line has text labeling a specific type of transporation (Ground, Standard Overnight, Express, etc.). Unfortunately, these aren't always in the exact same order. I need to have my VBA code tell SAP to search the table for specific text (in this case, STANDARD OVERNIGHT), and select that row.

Any ideas?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
UPDATE: Adding the code
Code:
Private Sub CommandButton1_Click()
MsgBox ("Please double click on the order you wish to alter the routing for and press ok")
'setting the connection with sap:
Dim App, Connection, session As Object
Dim StartRange As String
Dim EndRange As String
Set SapGuiAuto = GetObject("SAPGUI")
Set App = SapGuiAuto.GetScriptingEngine
Set Connection = App.Children(0)
Set session = Connection.Children(0)

session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[1]/btn[25]").presssession.findById("wnd[0]/tbar[1]/btn[8]").presssession.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\13").Select

session.findById("wnd [0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\13/ssubSUBSCREEN_BODY:SAPMV50A:2126/ssubCUSTOMER_SCREEN:SAPLZGWM_XPS_CUSTOM_TAB:9000/btnRATE_SHOP").presssession.findById("wnd[1]/usr/cmbGV_WERKS").Key = "3110"
session.findById("wnd[1]/usr/cmbGV_GROUP").SetFocus
session.findById("wnd[1]/usr/cmbGV_GROUP").Key = "DOM"
session.findById("wnd[1]/tbar[0]/btn[13]").press
session.findById("wnd[1]/usr/cmbGV_GROUP").SetFocus
Selection.Offset(0, 12).Select
EndRange = ActiveCell.Address
session.findById("wnd[2]/tbar[0]/btn[13]").press
session.findById("wnd[1]/tbar[0]/btn[14]").press
session.findById("wnd[0]/tbar[0]/btn[11]").press
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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