Hi,
I'm fairly new to macros and vba so I really apologize in advance. I'm trying to create a macro to obtain some information from IE which is in HTML format but I just don't know how. Where i work we use a program called SAP to process orders. I can create macros and pull any info i want from this program but It's hard for me to do it from Internet explorer.
This is the Macro I use to open IE which contains the info i need.
Sub RJ()
Set SapGuiAuto = GetObject("SAPGUI") 'Get the SAP GUI Scripting object
Set SAPApp = SapGuiAuto.GetScriptingEngine 'Get the currently running SAP GUI
Set SAPCon = SAPApp.Children(0) 'Get the first system that is currently connected
Set session = SAPCon.Children(0) 'Get the first session (window) on that connection
Application.DisplayAlerts = False 'No popups saying it's waiting for SAP
Dim Startrow
Startrow = 2
Begin:
Dim Order
Order = Worksheets("Sheet1").Cells(Startrow, "A").Value
If Order = "" Then Exit Sub
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "co02"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").Text = Order
session.findById("wnd[0]/usr/radR62CLORD-FLG_OVIEW").SetFocus
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtAFPOD-KDAUF").SetFocus
session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtAFPOD-KDAUF").caretPosition = 1
session.findById("wnd[0]").sendVKey 2
session.findById("wnd[0]/titl/shellcont[1]/shell").pressContextButton "%GOS_TOOLBOX"
session.findById("wnd[0]/titl/shellcont[1]/shell").selectContextMenuItem "%GOS_ZSD_ST_POPUP"
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
Application.Wait (Now + TimeValue("0:00:05"))
Startrow = Startrow + 1
GoTo Begin:
End Sub
Now, this is part of the html body. How can i transfer the data i need back to excel?
For example, the value I want from here is: "RITM1169936" (Picture Attached)
Macro.PNG
I would really appreciate if anyone could help me or at least point me in the right direction.
Thank you !
Bookmarks