Return a word count from a webpage/html for a list of words using VBA

Dschiavo01

New Member
Joined
Feb 11, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi All, first post, let me know if I can provide additional details and I will try.

I want to search a webpage for a list of words working down a column and return a count of how many times each word appears on the webpage. Thus far I've only been able to figure out how to search the page and return if the word exists at all, see below. I am a novice user of VBA as an FYI.

Thanks!

If InStr(URL, Ticker) = 0 Then
ActiveSheet.Range("B2").Value = "Not Found"
Else
ActiveSheet.Range("B2").Value = "Found"
End If
Exit Sub
 
Hi, the above macro will count the number of words in the URL not on the page. The code you shared was trying the same thing and hence modified the same.

Would you like to count the words in the page?
Yes, the goal is to count the words on the page (not one total, return a count of individual an word or words from a list in a column) that the URL opens. I’ve tried both opening the page and counting the words and trying to have VBA look to the HTML where most of the words are imbed with no luck, it just keeps reading the URL itself.
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi, the above macro will count the number of words in the URL not on the page. The code you shared was trying the same thing and hence modified the same.

Would you like to count the words in the page?
Yes, the goal is to open the webpage and count the words within the webpage itself.

-It doesn't need to open the webpage if there's a way to code around that.
-I've poked around at reading the HTML or exporting and then reading the HTML export as well without success, but just throwing that out there in the event it's useful as an idea.

sorry for double reply, it didn't show the other reply posting, and I'm not sure how to delete lol
 
Upvote 0
Hi, the above macro will count the number of words in the URL not on the page. The code you shared was trying the same thing and hence modified the same.

Would you like to count the words in the page?
Yes, the goal is to count the words on the page, but not just the total words. The goal is to return a count by word for a list of words in a column in the excel file.
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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