- Joined
- Aug 18, 2017
- Messages
- 1
- Reaction score
- 0
Hi,
The coding for select drop-down data using libre calc macro,
Option VBASupport 1
Sub dropdown()
URL = "http://www.vaughtgroup.com/search-results/?alllistings#headeranchor"
Dim propertytype As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = "True"
ie.Navigate URL
Do While ie.ReadyState <> 4
DoEvents
Loop
Set html=ie.document.body
Set propertytype = html.getElementsByTagName("select")
MsgBox propertytype.Length
Set pr=propertytype(4).getElementsByTagName("option")
MsgBox pr.Length
For i=0 To pr.Length-1
MsgBox pr(i).innerText
If (InStr(pr(i).innerText,"Industrial")>0) Then
pr.Selected()
Exit For
End If
Next
Set submitlink = html.getElementsByClassName("btn btn-large btn-block btn-darkgray")
For Each submit In submitlink
if(submit.innerText="Search") Then
ie.Navigate submit
Do While ie.ReadyState <> 4
Doevents
Loop
Exit For
End If
Next
End Sub
When coding is running in this step "pr.Selected()" it will give error as " BASIC runtime error.'423' Selected"
How to select drop down data using libre calc macro??
Kindly give some suggestion about this...
The coding for select drop-down data using libre calc macro,
Option VBASupport 1
Sub dropdown()
URL = "http://www.vaughtgroup.com/search-results/?alllistings#headeranchor"
Dim propertytype As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = "True"
ie.Navigate URL
Do While ie.ReadyState <> 4
DoEvents
Loop
Set html=ie.document.body
Set propertytype = html.getElementsByTagName("select")
MsgBox propertytype.Length
Set pr=propertytype(4).getElementsByTagName("option")
MsgBox pr.Length
For i=0 To pr.Length-1
MsgBox pr(i).innerText
If (InStr(pr(i).innerText,"Industrial")>0) Then
pr.Selected()
Exit For
End If
Next
Set submitlink = html.getElementsByClassName("btn btn-large btn-block btn-darkgray")
For Each submit In submitlink
if(submit.innerText="Search") Then
ie.Navigate submit
Do While ie.ReadyState <> 4
Doevents
Loop
Exit For
End If
Next
End Sub
When coding is running in this step "pr.Selected()" it will give error as " BASIC runtime error.'423' Selected"
How to select drop down data using libre calc macro??
Kindly give some suggestion about this...