Click here to Skip to main content
14,872,070 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have trying to scraping the data from internet. But I have this error.

What I have tried:

Sub testBid()
Dim link As String
        link = "https://www.freelancer.com/projects/php/creating-notification-warning-system/"
        MsgBox (FuncUpdateBid(link))
        'MsgBox (FuncProBudget(link))
End Sub

Function FuncUpdateBid(ByVal Plink As String) As String
    Dim appIE As InternetExplorer
    Set appIE = CreateObject("internetexplorer.application")
    With appIE
        .navigate Plink
        .Visible = True
    End With
    Do While appIE.Busy
        DoEvents
    Loop
    Dim sbid As String
    'Dim Bid As Object
    Dim Bid As IHTMLElement
    Set Bid = appIE.document.getElementById("num-bids")<pre>' <-- error code 424, object required


'Set Bid = appIE.document.getElementsByTagName("num-bids")
sbid = Bid.innerText
FuncUpdateBid = sbid
'FuncUpdateBid = Bid.innerText
appIE.Quit
Set appIE = Nothing
End Function
Posted
Updated 15-Apr-18 23:53pm
v2
Comments
Maciej Los 16-Apr-18 2:45am
   
What line?
Richard MacCutchan 16-Apr-18 3:42am
   
Use the macro debug feature to step through the code. You can then clearly see which object is not getting set.
hmanhha 16-Apr-18 5:36am
   
Set Bid = appIE.document.getElementById("num-bids") ' <-- error code 424, object required
Richard MacCutchan 16-Apr-18 5:52am
   
A quick view of the source of that page shows that "num-bids" does not exist. Something you could have found for yourself quite easily.
Maciej Los 16-Apr-18 6:31am
   
Hawk eye!
Richard MacCutchan 16-Apr-18 6:53am
   
Ctrl-F actually.
hmanhha 16-Apr-18 9:16am
   
It have.

div id="num-bids" class="text-blue larger bold">

7


</div
Richard MacCutchan 16-Apr-18 13:09pm
   
You must be looking at a different page from the one you have posted in your question. I have tried three times and it still cannot find any items with that name.
hmanhha 16-Apr-18 9:07am
   
"
7


"

No it have.
hmanhha 16-Apr-18 5:35am
   
Function FuncUpdateBid(ByVal Plink As String) As String
Dim appIE As InternetExplorer
Set appIE = CreateObject("internetexplorer.application")
With appIE
.navigate Plink
.Visible = True
End With
Do While appIE.Busy
DoEvents
Loop
Dim sbid As String
'Dim Bid As Object
Dim Bid As IHTMLElement
Set Bid = appIE.document.getElementById("num-bids") ' <-- error code 424, object required
'Set Bid = appIE.document.getElementsByTagName("num-bids")
sbid = Bid.innerText
FuncUpdateBidV1 = sbid
'FuncUpdateBid = Bid.innerText
appIE.Quit
Set appIE = Nothing
End Function
Richard MacCutchan 16-Apr-18 5:50am
   
That suggests that the element "num-bids" cannot be found.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900