Hey All,
Looking for some help that i am going a bit mad trying to figure out!! I am writing a VBA that needs to open a report via a Internet explorer Webpage. I am having some success but stuck when a pop up box appears that i need to close. I have been using the IE DOM Explorer to get the ID of the buttons i need to press and input data etc. but i can't get it to close a pop up box See image attached. I think it is because it has no ID called out struggling to figure out how to do this, thinking it might be an "A" Tag"? hyper link.
The 'Select Element' within IE shows it as the following
<IMG tabIndex=-1 class=urPWButtonImage border=0 src="http://bhbh1as13.ent.bhicorp.com:8013/sap/public/bc/ur/nw5/1x1.gif" action="close">
the VBA i have written so far is as follows, area i have an issue with is when i try to click on "WDW02-spr" have tried "WDW02-Close" as well
Any and all help greatly appreciated
Looking for some help that i am going a bit mad trying to figure out!! I am writing a VBA that needs to open a report via a Internet explorer Webpage. I am having some success but stuck when a pop up box appears that i need to close. I have been using the IE DOM Explorer to get the ID of the buttons i need to press and input data etc. but i can't get it to close a pop up box See image attached. I think it is because it has no ID called out struggling to figure out how to do this, thinking it might be an "A" Tag"? hyper link.
The 'Select Element' within IE shows it as the following
<IMG tabIndex=-1 class=urPWButtonImage border=0 src="http://bhbh1as13.ent.bhicorp.com:8013/sap/public/bc/ur/nw5/1x1.gif" action="close">
the VBA i have written so far is as follows, area i have an issue with is when i try to click on "WDW02-spr" have tried "WDW02-Close" as well
VBA Code:
Sub SearchBot()
'dimension (declare or set aside memory for) our variables
Dim objIE As InternetExplorer
Dim aEle As HTMLLinkElement
Dim y As Integer
Dim result As String
'initiating a new instance of Internet Explorer and asigning it to objIE
Set objIE = New InternetExplorer
'make IE browser visible (False would allow IE to run in the background)
objIE.Visible = True
'navigate IE to this web page
objIE.navigate "http://bhbh1as13.ent.bhicorp.com:8013/sap/bc/webdynpro/sap/zbhzoob_addflds_mntn?sap-language=EN"
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
'ORDERNUMBER AS IN cell "A2" value
objIE.document.getElementById("WD30").Value = _
Sheets("Sheet1").Range("A2").Value
'& " in " & Sheets("Sheet1").Range("C1").Value
'PLANT NUMBER WRITTEN IN F1
objIE.document.getElementById("WD6F").Value = _
Sheets("Sheet1").Range("F1").Value
objIE.document.getElementById("WD30-btn").Click
'wait again for the browser
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
[B] 'help issue i am having BELOW ************
objIE.document.getElementById("WDW02-spr").Click
'wait again for the browser
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop[/B]
'click the 'go' button
objIE.document.getElementById("WDDC").Click
'wait again for the browser
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
End Sub
Any and all help greatly appreciated