Consulting

Results 1 to 5 of 5

Thread: VBA to extract data from WebPages

  1. #1

    VBA to extract data from WebPages

    I understand it is possible to write VBA to extract information from web pages. Never done this before but can anyone recommend a starter book or reference site I can read to understand where to start?

  2. #2
    I am new to this but learning
    Sharing something to get an idea here
    Refer
    39490-IE-Automation-using-VBA

    Also you may refer some VBA programming books online, else this site members are well knowledgeable in all the way to help you.

  3. #3
    Thanks imgaur7 that's a start and I'll have a read and go from there. think i'll need more help though in the future.

  4. #4
    Quote Originally Posted by LutonBarry View Post
    Thanks imgaur7 that's a start and I'll have a read and go from there. think i'll need more help though in the future.
    Great and happy to help you in a way....let me know more if required I will share my findings....though waiting for my help ☺

  5. #5
    Quote Originally Posted by imgaur7 View Post
    Great and happy to help you in a way....let me know more if required I will share my findings....though waiting for my help ☺
    Dim IE as Object
    Sub Sprint()
       Dim objelement As Object
       Dim c As Integer
       Dim LastRow, i, j As Integer
      
       Set IE = CreateObject("InternetExplorer.Application")
       
       With IE
          .Visible = True
          .navigate "https://website url here #"
          
          'wait until first page loads
       Ieready
          On Error Resume Next
    
    Set sht = ThisWorkbook.Worksheets("Data")
    LastRow = sht.Cells(sht.Rows.Count, "B").End(xlUp).Row
    For j = 4 To LastRow
           
        i = 112
                 
             If IE.document.all.Item(i).innertext = "ÔÍÑ (ãîñ. ïîøëèíà)" Then
             IE.document.all.Item(i).Click
             
             End If
        
       IE.Visible = True
       
       Ieready
             
       'populate fields
       
       With IE.document
          'text boxes
          
          .all("fio").Value = sht.Cells(j, 1)
          .all("contact").Value = sht.Cells(j, 2)
          .all("payer_address").Value = sht.Cells(j, 3)
          .all("inn_from").Value = sht.Cells(j, 4) '"771562265931"
          .all("inn").Value = sht.Cells(j, 5) '"7726062105"
          .all("account").Value = sht.Cells(j, 6) '"45914000"
          .all("purpose").Value = sht.Cells(j, 7)
          .all("comment").Value = sht.Cells(j, 8) '"02.04.2016"
          .all("sum").Value = sht.Cells(j, 10) '"1000"
          .all("get_total_sum").Click
          '.all("now_pay").Click
        
        End With
            Set IE = Nothing
    
        Next j
     End With
    End Sub
    Private Sub Wait(ByVal wSec As Long)
        wSec = wSec + Timer
        Do While Timer < wSec
           DoEvents
        Loop
    End Sub
    Private Sub Ieready()
        Wait 5
        Do While IE.readyState <> 4
            Wait 5
        Loop
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •