Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get value from web page

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
425
IT
MY PROGRESS:

Sub LIST_PIVA() 'VAT

Const URL As String = "
Dim oHtml As HTMLDocument, post As Object, R&
Dim Elements As IHTMLElementCollection
Dim Element As IHTMLElement

Set IE = CreateObject("InternetExplorer.Application")

With IE
.Visible = True
.navigate URL
Do While .Busy: DoEvents: Loop
While .Busy Or .readyState < 4: DoEvents: Wend
Set oHtml = .document
End With

Sleep (500)

oHtml.getElementById("search_input").Value = "02916070606"

Sleep (500)

Dim ButtonElement As MSHTML.HTMLButtonElement

IE.document.getElementsByClassName("btn btn-primary btn-sm text-uppercase")(0).Click

Do While IE.Busy: DoEvents: Loop
While IE.Busy Or IE.readyState < 4: DoEvents: Wend

'For Each ButtonElement In IE.document.getElementsByTagName("BUTTON")
'Debug.Print ButtonElement.className
'If ButtonElement.className = "btn btn-primary btn-sm text-uppercase" Then
' ButtonElement.Click
' Exit Sub
'End If
'Next ButtonElement

'For Each post In oHtml.getElementById("search_input").getElementsByTagName("td")
'COLLEGIO = post.innerText
'SQL = "INSERT INTO COLLEGI ([COLLEGIO]) VALUES " & _
"('" & Replace(COLLEGIO, "'", "''") & "')"
'CN.Execute SQL, , adCmdText + adExecuteNoRecords
'Next

'If Not (RS Is Nothing) Then
'If (RS.State And adStateOpen) = adStateOpen Then RS.Close
'Set RS = Nothing
'End If

'SQL = "SELECT COLLEGIO FROM COLLEGI"
'Set RS = New ADODB.Recordset
'RS.CursorLocation = adUseClient
'RS.Open Source:=SQL, _
ActiveConnection:=CN, _
CursorType:=adOpenForwardOnly, _
LockType:=adLockReadOnly
'RS.Sort = ("COLLEGIO ASC")

'Do While Not RS.EOF
'COLLEGIO = RS.Fields(0).Value
'Call SELEZIONA_COLLEGIO
'RS.MoveNext
'Loop

'If Not (RS Is Nothing) Then
' If (RS.State And adStateOpen) = adStateOpen Then RS.Close
' Set RS = Nothing
'End If

End Sub

Afyer the line: IE.document.getElementsByClassName("btn btn-primary btn-sm text-uppercase")(0).Click

i need to get the value in table.

see image

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top