Hi all , this is my first post I hope I get across my idea clearly ( my first web VBA please be gentle
):
What I want to achieve:
1) open a web page http://www.bmreports.com/bwh_Mid.htm
2) insert date and period in the text box and click "go"
3) once the data is displayed I need to import them in eirther excel or access
I found lot of problem in inserting data and periods in the textbox , unfortunately the web queries are not displayed in the browser
Below the code I have used :
Sub GetMarketPrice()
Dim ie As Object, ipf As Object
Dim strURL As String
Dim tries
Set ie = CreateObject("InternetExplorer.Application")
strURL = "http://www.bmreports.com/bwh_Mid.htm"
Dim ieObj As HTMLInputElement
ie.Navigate strURL
While ie.busy
DoEvents 'wait until IE is done loading page.
Wend
'Set ieObj = ie.document.All("param0")
'ieObj.Value = "2012-01-01" 'run-time error -91
'###################################################################
'enter date
Set ipf = ie.document.getElementById("param0")
ipf.Value = "2011-01-05" 'fill in the text box (here error)
ie.document.All("param0").Value = "2011-01-01"
'###################################################################
'################################################################
'I have also tried this: But againd failed
''Set ipf = ie.Document.getElementbytagname("param0")
''ipf.Value = "2011-01-05" 'fill in the text box
'''Set ipf = IE.document.getElementByName("param0")
''ipf.Value = "2011-01-05" 'fill in the text box
'###################################################################
End Sub
below the web code:
Bookmarks