• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

scraping webpage and transfering details in excel by VBA

Dalia

Member
Hi,

Below is my macrocode where I want to scrap the webpage. the job title, location, experience and description should come to my excel sheet but this macro is showing an error in this line of code
str1.Item(0).Value = str
can you tell me where am going wrong?
Below here is the macro code

Code:
Sub scrapingwebpae()
Dim ie As Object, obj As Object
Dim elemcollection As Object
Dim erow As Long
Dim str As String
Dim zipcode As Variant
Dim expyears As Long
Dim str1 As Variant
Dim code As Variant
Dim exp As Variant
Range("a1").Value = "job title"
Range("b1").Value = "company"
Range("c1").Value = "location"
Range("d1").Value = "description"
With ActiveSheet
erow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
End With

Set ie = CreateObject("internetexplorer.application")
str = InputBox("enter job title/keywords")

expyears = InputBox("enter years experience")
zipcode = InputBox("enter location")
'openwebpage
With ie
.Visible = True
.navigate ("http://www.monsterindia.com/")
Do While .busy Or .readystate <> 4
DoEvents
Loop
Set str1 = .document.getelementsbyname("Jobs Title, Keywords")
str1.Item(0).Value = str
'"exp_container","auto_loc_wrap"
Set exp = .document.getelementsbyname("exp_container")
Set exp.Item(0).Value = expyears
Set code = .document.getelementbyname("location")
Set code.Item(0).Value = zipcode
.document.getelementbyid("submit").Click

End With

End Sub


_____________________________________________________________

Post Moved by Moderator

.
 
Last edited by a moderator:
Back
Top