Run-time error 424 Object Required

ottokyleneidert

New Member
Joined
Aug 21, 2014
Messages
7
I have a macro that pulls data from a website-or should.

The website is: Gas Quality - Query - Chromatograph

A 424 error occurs and the line that the Debugger goes to is this one: ie.document.getElementById("frmPstDate").Value = mydate

The macro, copied and pasted here, there is more to it, but this is the section I am attempting to fix at the moment. Any help would be greatly appreciated:

Sub find_row2()

Dim ie As InternetExplorer
Dim myrow As Integer
Dim mydate As String
Dim mycell As String

myrow = 11

Set ie = New InternetExplorer
ie.Visible = False

Do
mydate = Sheets("Tuscarora").Cells(myrow, 1)
mycell = Sheets("Tuscarora").Cells(myrow, 2)
tuscarora mydate, ie
If Sheets("Data").Cells(1, 1) = "" Then
Sheets("Tuscarora").Cells(myrow, 16) = ""
Else
dereks_clean_up2 myrow
End If
If mycell <> "" Then
Exit Do

Else
myrow = myrow + 1
End If

Loop Until mydate = ""

ie.Quit

End Sub
Sub tuscarora(mydate As String, ie As InternetExplorer)

Dim url As String
Dim thelements As IHTMLElementCollection
Dim thelement As IHTMLTableCell
Dim tdelements As IHTMLElementCollection
Dim tdelement As IHTMLTableCell

url = "http://anrebb.transcanada.com/GasQuality/GQQuery.asp?sPipelineCode=TUS&sComponentType=Chromatograph"

ie.navigate (url)

While ie.Busy
DoEvents
Wend
While ie.Busy
DoEvents
Wend

ie.document.getElementById("frmPstDate").Value = mydate
ie.document.all("B1").Click

While ie.Busy
DoEvents
Wend

With Sheets("Data")

.Range("A1:ZZ500").Clear

Set thelements = ie.document.getElementsByTagName("th")
Set tdelements = ie.document.getElementsByTagName("td")



For Each thelement In thelements
.Range("A1").Offset(0, r) = thelement.innerText
r = r + 1
Next

r = 1

For Each tdelement In tdelements
.Range("A2").Offset(0, r) = tdelement.innerText
r = r + 1
Next

End With
End Sub
 

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