Prikazi cijelu temu 09.04.2022 11:48
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Re:VBA scraping
Nece niko ni da proba.
PreuzmiIzvorni kôd (Visual Basic):
  1. Function test()
  2.    
  3. the_start:
  4.    
  5.     Set objIE = CreateObject("InternetExplorer.Application")
  6.     objIE.Top = 0
  7.     objIE.Left = 0
  8.     objIE.Width = 800
  9.     objIE.Height = 600
  10.     objIE.Visible = False 'We will see the window navigation
  11.    
  12.     On Error Resume Next
  13.     objIE.Navigate ("https://icentar.ba/icentar/showtopic.php?id=22")
  14.    
  15.     Do
  16.     DoEvents
  17.         If Err.Number <> 0 Then
  18.             objIE.Quit
  19.             Set objIE = Nothing
  20.             GoTo the_start:
  21.         End If
  22.     Loop Until objIE.ReadyState = 4
  23.    
  24.    
  25.     Dim AllString As String
  26.    
  27.     Set Alllinks = objIE.Document.getElementsByTagName("div")
  28.     For Each Hyperlink In Alllinks
  29.        ime = Hyperlink.className
  30.         If ime = "bbody iefix_left" Then
  31.             AllString = Hyperlink.innerText
  32.              MsgBox AllString
  33.             MsgBox Hyperlink.Name
  34.              'Exit For
  35.        End If
  36.     Next
  37.    
  38. Set objIE = Nothing
  39. End Function

Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.