I have an HTMLElementCollection that I come across using the For Each Loop option to see if InnerHTML contains specific words. If they contain any of these keywords, it is saved in a file.
Everything works fine, but I was wondering if there is a way to simplify. Here is a sample
For Each Helement As HtmlElement In elements If Helement.InnerHtml.Contains("keyword1") Or Helement.InnerHtml.Contains("keyword2") Or Helement.InnerHtml.Contains("keyword3") Or Helement.InnerHtml.Contains("keyword4") Or Helement.InnerHtml.Contains("keyword5") = True Then ' THE CODE TO COPY TO FILE End If Next Helement
Is there anything that will work as follows:
If Helement.InnerHtml.Contains("keyword1", "keyword2", "keyword3", "keyword4", "keyword5")
The way I do it now just seems wasteful, and I'm pretty OCD about it.
user157603
source share