VBA_Selecting Filter on Site

Pankil

New Member
Joined
Aug 1, 2019
Messages
16
Hello guys,




  • i am working on project where i need vba code to click on "Add Filter", code here looks like -

<div class="select-filter-field no-filters" ng-class="{'no-filters' : currentOptions.length === 0}" ng-click="addFilter()">
<i class="fa fa-fw fa-filter"></i>
Add filter
</div>

event is also there which shows like -

function(e) {
return void 0 !== T && T.event.triggered !== e.type ? T.event.dispatch.apply(t, arguments) : void 0
}



  • after clicking on said "Add filter" small list opens up and i require to click on say 4th item. code is -

<li class="filter-type-option" ng-repeat="field in ::filterFields" ng-click="setFilterField(filter, field)" ng-hide="filterFieldApplied(field.field)">
<i class="fa fa-fw fa-calendar" ng-class="field.icon"></i>
Date
</li>

again event is like -

function(e) {
return void 0 !== T && T.event.triggered !== e.type ? T.event.dispatch.apply(t, arguments) : void 0
}

Thanks in advance........
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hello

Can you post the page address where the control is or is it a restricted site?
 
Upvote 0
Hi,

Actually its restricted so not able to share it. can share url but that would be of no help.....
 
Upvote 0
Can you post the actual image of the code inspect window for the add filter control, as exemplified below?

Gr21Pfq.jpg
 
Upvote 0
I cannot see it. You have to upload it to a hosting site and paste a link here, it will display as either a text link or the picture itself, as I did. I am using Imgur to share my images.
Alternatively, you could email it to me.
Considering I cannot test with the actual site, this will increase our chances of success.
 
Upvote 0
I can see it now. Please test the code below and report the results:

Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Sub test()
Dim IE As Object, htmlDoc As Object, sURL$, col, cs, cn$
Set IE = CreateObject("internetexplorer.application")
sURL = "http://www.physiofirst.org.uk/find-physio/search-physio.html"   ' your URL here
cn = "form-control mod-text-display"     ' my testing
'cn = "select-filter-field no-filters"   ' use this one, appears to be your class
With IE
    .navigate (sURL)
    .Visible = True
End With
WaitIE IE, 2000
Set htmlDoc = IE.Document
Set col = htmlDoc.getElementsByClassName(cn)
MsgBox col.Length & " elements.", 64
For Each cs In col
    MsgBox cs.Type, 64, "Type"
Next
WaitIE IE, 1000
End Sub


Sub WaitIE(IE As Object, Optional time As Long = 250)
Do
    Sleep time
Loop Until IE.readyState = 4 Or Not IE.Busy
End Sub
 
Upvote 0
Hey buddy,

thanks for this. i tested the same and getting Run-time error '438' at line - "MsgBox cs.Type, 64, "Type"
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top