{"id":909,"date":"2022-09-11T12:15:27","date_gmt":"2022-09-11T06:45:27","guid":{"rendered":"http:\/\/new.codingislove.com\/?p=909"},"modified":"2022-09-11T13:45:33","modified_gmt":"2022-09-11T08:15:33","slug":"parse-html-in-excel-vba","status":"publish","type":"post","link":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/","title":{"rendered":"Parse HTML in Excel VBA &#8211; Learn by parsing hacker news home page (Updated 2022)"},"content":{"rendered":"<p>Why parse HTML in Excel VBA? There may be different cases where we need to parse HTML in Excel. Few cases are generating multiple HTML files based on excel data, editing multiple HTML files, scraping some data etc.<!--more--><\/p>\n<p>I&#8217;m using <a href=\"https:\/\/news.ycombinator.com\/news\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Hacker News homepage<\/a> for this example where we parse all the posts from homepage. Of course, Hacker News has its own API which can be used to pull latest topics but this example is just to learn how to parse HTML.<\/p>\n<p>Why Hacker News? Because everyone knows Hacker News!<\/p>\n<p>Final output looks like image below.<\/p>\n<p><img decoding=\"async\" class=\"myborder\" src=\"http:\/\/i.imgur.com\/7cHp3do.png\" alt=\"parse html in vba\"><\/p>\n<h3>Getting started<\/h3>\n<ol>\n<li>Microsoft HTML object library is used in parsing HTML.<\/li>\n<li>Open script editor in excel (alt + f11) and add a reference to Microsoft HTML object library (Tools &gt; references &gt; select)<\/li>\n<\/ol>\n<p><strong>A few basics first and then dive into code!<\/strong><\/p>\n<h3>Defining and setting HTML<\/h3>\n<p>HTML object can be defined using :<\/p>\n<pre>Dim html As New HTMLDocument\n<\/pre>\n<p>HTML can be set to this object using this syntax :<\/p>\n<pre>html.body.innerHTML = htmlstring\n<\/pre>\n<h3>Useful methods and properties<\/h3>\n<p>There are many methods and properties of HTML object and elements. You can have a look at all the methods using autocomplete but most useful methods are properties are as follows:<\/p>\n<ol>\n<li><code>getElementsByTagName<\/code><\/li>\n<li><code>getElementsByClassName<\/code><\/li>\n<li><code>getElementById<\/code><\/li>\n<li><code>getAttribute<\/code><\/li>\n<li><code>innerText<\/code><\/li>\n<li><code>innerHTML<\/code><\/li>\n<\/ol>\n<h3>Steps<\/h3>\n<ol>\n<li>First, we pull Hacker News homepage by making a basic HTTP GET request. Read more about HTTP requests here &#8211; <a href=\"https:\/\/codingislove.com\/http-requests-excel-vba\/\" target=\"_blank\" rel=\"noopener noreferrer\">Http requests in Excel VBA<\/a><\/li>\n<li>Set HTTP response to our HTML object.<\/li>\n<li>Get all the latest topics using <code>getElementsByClass<\/code> method<\/li>\n<li>Loop through each topic, parse each topic&#8217;s title, link, upvotes and username using different methods.<\/li>\n<li>Enter all parsed values to sheet 1<\/li>\n<\/ol>\n<!-- \/112371330\/post-banner -->\r\n<div class=\"ad-wrapper\">\r\n<div id='div-gpt-ad-1595500140430-0' style='width: 250px; height: 250px;'>\r\n  <script>\r\n    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1595500140430-0'); });\r\n  <\/script>\r\n<\/div>\r\n<\/div>\n<h3>Complete Code<\/h3>\n<p>Have a look at the code first.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nPublic Sub parsehtml()\nDim http As Object, html As New HTMLDocument, topics As Object, titleElem As Object, detailsElem As Object, topic As HTMLHtmlElement\nDim i As Integer\nSet http = CreateObject(&quot;MSXML2.XMLHTTP&quot;)\nhttp.Open &quot;GET&quot;, &quot;https:\/\/news.ycombinator.com\/&quot;, False\nhttp.send\nhtml.body.innerHTML = http.responseText\nSet topics = html.getElementsByClassName(&quot;athing&quot;)\ni = 2\nFor Each topic In topics\nSet titleElem = topic.getElementsByTagName(&quot;td&quot;)(2)\nSheets(1).Cells(i, 1).Value = titleElem.getElementsByTagName(&quot;a&quot;)(0).innerText\nSheets(1).Cells(i, 2).Value = titleElem.getElementsByTagName(&quot;a&quot;)(0).href\nSet detailsElem = topic.NextSibling.getElementsByTagName(&quot;td&quot;)(1)\nSheets(1).Cells(i, 3).Value = detailsElem.getElementsByTagName(&quot;span&quot;)(0).innerText\nSheets(1).Cells(i, 4).Value = detailsElem.getElementsByTagName(&quot;a&quot;)(0).innerText\ni = i + 1\nNext\nEnd Sub\n<\/pre>\n<p><strong>When I say topics, I mean posts.<\/strong><\/p>\n<h3>Code Explanation<\/h3>\n<ol>\n<li>First we define all the required objects like <code>HTMLDocument<\/code>, <code>MSXML2.XMLHTTP<\/code><\/li>\n<li>Topics object to store topics which will be used to loop. I&#8217;ve defined few other objects like <code>titleElem<\/code> and <code>detailsElem<\/code> to make code readable.<\/li>\n<li>get homepage and set its HTML to our HTML object in line 7<\/li>\n<li>Now we have to get all the topic elements. We have to identify those elements to get them. In this htmlpage, all topic elements have a class named <code>athing<\/code> so we can use <code>getElementsByClassName<\/code> method to get those elements.<\/li>\n<li>How to identify elements? By viewing page source or inspecting element in chrome (right click on element &gt; inspect)<\/li>\n<li>In line 8, We get all the topics using <code>getElementsByClassName<\/code> method by specifying the class name <code>athing<\/code>. Next we loop through all the topics using a <code>For<\/code> loop<\/li>\n<li>All the topics are in a <code>table<\/code> element and each topic is a <code>tr<\/code> element (row) and topic&#8217;s details are in the next <code>tr<\/code> element. Each row has sub-parts : <code>td<\/code> elements which have the content like topic name, domain name, upvotes, username etc.<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"myborder\" src=\"https:\/\/i.imgur.com\/WLa6lgI.png\" alt=\"parse html in excel vba\"><\/p>\n<ol>\n<li>Topic title and domain are in the third <code>td<\/code> element so we get it using <code>getElementsByTagName(\"td\")(2)<\/code> (Index starts at 0). Topic name and link is in another <code>a<\/code> element so we get it using <code>getElementsByTagName(\"a\")(0)<\/code> and enter its values in sheet 1<\/li>\n<li>Topic details like upvotes and username are in the next element to topic element so we get it using <code>NextSibling<\/code> method. Get upvotes and username which are in <code>span<\/code> and <code>a<\/code> elements and enter in sheet 1.<\/li>\n<li>Integer <code>i<\/code> is used to store row number which starts at 2 and increments with every topic.<\/li>\n<\/ol>\n<!-- \/112371330\/post-rectange -->\r\n<div class=\"ad-wrapper\">\r\n<div id='div-gpt-ad-1595415581471-0' style='width: 300px; height: 250px;'>\r\n  <script>\r\n    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1595415581471-0'); });\r\n  <\/script>\r\n<\/div>\r\n<\/div>\n<h3>Wrapping up<\/h3>\n<p>HTML Elements can also be defined as <code>HTMLBaseElement<\/code> for auto completion.<\/p>\n<p>There are many ways of identifying an element in HTML. Using ID, Class name, Tag name etc. XPath can also be using to identify element but VBA doesn&#8217;t have built-in support for XPath. Here&#8217;s a custom function to identify elements using XPath.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nPublic Function getXPathElement(sXPath As String, objElement As Object) As HTMLBaseElement\nDim sXPathArray() As String\n\nDim sNodeName As String\nDim sNodeNameIndex As String\nDim sRestOfXPath As String\nDim lNodeIndex As Long\nDim lCount As Long\n\n' Split the xpath statement\nsXPathArray = Split(sXPath, &quot;\/&quot;)\nsNodeNameIndex = sXPathArray(1)\nIf Not InStr(sNodeNameIndex, &quot;&#x5B;&quot;) &amp;gt; 0 Then\nsNodeName = sNodeNameIndex\nlNodeIndex = 1\nElse\nsXPathArray = Split(sNodeNameIndex, &quot;&#x5B;&quot;)\nsNodeName = sXPathArray(0)\nlNodeIndex = CLng(Left(sXPathArray(1), Len(sXPathArray(1)) - 1))\nEnd If\nsRestOfXPath = Right(sXPath, Len(sXPath) - (Len(sNodeNameIndex) + 1))\n\nSet getXPathElement = Nothing\nFor lCount = 0 To objElement.ChildNodes().Length - 1\nIf UCase(objElement.ChildNodes().item(lCount).nodeName) = UCase(sNodeName) Then\nIf lNodeIndex = 1 Then\nIf sRestOfXPath = &quot;&quot; Then\nSet getXPathElement = objElement.ChildNodes().item(lCount)\nElse\nSet getXPathElement = getXPathElement(sRestOfXPath, objElement.ChildNodes().item(lCount))\nEnd If\nEnd If\nlNodeIndex = lNodeIndex - 1\nEnd If\nNext lCount\nEnd Function\n<\/pre>\n<p><i>If you have any questions or feedback, comment below.<\/i><br \/>\n<script>(function() {\n\twindow.mc4wp = window.mc4wp || {\n\t\tlisteners: [],\n\t\tforms: {\n\t\t\ton: function(evt, cb) {\n\t\t\t\twindow.mc4wp.listeners.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tevent   : evt,\n\t\t\t\t\t\tcallback: cb\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n})();\n<\/script><!-- Mailchimp for WordPress v4.10.7 - https:\/\/wordpress.org\/plugins\/mailchimp-for-wp\/ --><form id=\"mc4wp-form-1\" class=\"mc4wp-form mc4wp-form-177 mc4wp-form-theme mc4wp-form-theme-red\" method=\"post\" data-id=\"177\" data-name=\"Subscribe to Coding is Love\" ><div class=\"mc4wp-form-fields\"><p>\r\n  <strong><a style=\"cursor:pointer\" onclick=\"OneSignal.push(function() {OneSignal.registerForPushNotifications()});\">Get notified when there's a new post by clicking on<img decoding=\"async\" style=\"transform:scale(0.75,0.75)\" src=\"https:\/\/i.imgur.com\/lTEcCYt.png\" alt=\"notification-bell\"\/>in bottom left<\/a><\/strong>\r\n<\/p>\r\n\r\n<p>\r\n  <strong>Need some help? Post your questions on our <a href=\"https:\/\/forum.codingislove.com\" target=\"_blank\">forum<\/a><\/strong>\r\n<\/p>\r\n<!--<br>\r\n<script id=\"mNCC\" language=\"javascript\">\r\n   medianet_width = \"300\";\r\n   medianet_height = \"250\";\r\n   medianet_crid = \"892699656\";\r\n   medianet_versionId = \"111299\";\r\n   (function() {\r\n       var isSSL = 'https:' == document.location.protocol;\r\n       var mnSrc = (isSSL ? 'https:' : 'http:') + '\/\/contextual.media.net\/nmedianet.js?cid=8CUWS5M33' + (isSSL ? '&https=1' : '');\r\n       document.write('<scr' + 'ipt type=\"text\/javascript\" id=\"mNSC\" src=\"' + mnSrc + '\"><\/scr' + 'ipt>');\r\n   })();\r\n<\/script>\r\n<p>\r\n    Liked this post? Join our newsletter to get more stuff like this in your inbox.\r\n<\/p>\r\n<p>\r\n\t<label>Email address: <\/label>\r\n\t<input type=\"email\" name=\"EMAIL\" placeholder=\"Your email is safe with us!\" required \/>\r\n<\/p>\r\n<p>\r\n\t<input type=\"submit\" value=\"Sign up\" \/>\r\n<\/p>\r\n--><\/div><label style=\"display: none !important;\">Leave this field empty if you're human: <input type=\"text\" name=\"_mc4wp_honeypot\" value=\"\" tabindex=\"-1\" autocomplete=\"off\" \/><\/label><input type=\"hidden\" name=\"_mc4wp_timestamp\" value=\"1777177147\" \/><input type=\"hidden\" name=\"_mc4wp_form_id\" value=\"177\" \/><input type=\"hidden\" name=\"_mc4wp_form_element_id\" value=\"mc4wp-form-1\" \/><div class=\"mc4wp-response\"><\/div><\/form><!-- \/ Mailchimp for WordPress Plugin --><\/p>\n<!-- \/112371330\/after-post -->\r\n<div class=\"ad-wrapper\">\r\n<div id='div-gpt-ad-1595272670647-0' style='width: 750px; height: 100px;'>\r\n  <script>\r\n    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1595272670647-0'); });\r\n  <\/script>\r\n<\/div>\r\n<\/div>\n<div style=\"margin-top: 15px; margin-bottom: 15px;\" class=\"sharethis-inline-share-buttons\" ><\/div>","protected":false},"excerpt":{"rendered":"<p>Why parse HTML in Excel VBA? There may be different cases where we need to parse HTML in Excel. Few cases are generating multiple HTML&hellip; <\/p>\n","protected":false},"author":1,"featured_media":2690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[11,12,22],"class_list":["post-909","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-excel","tag-vba","tag-web-scraping"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Parse HTML in Excel VBA - Learn by parsing hacker news home page<\/title>\n<meta name=\"description\" content=\"A detailed tutorial on how to parse HTML in VBA using Microsoft HTML object library. This includes practical example where we parse Hacker News homepage.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Parse HTML in Excel VBA - Learn by parsing hacker news home page\" \/>\n<meta property=\"og:description\" content=\"A detailed tutorial on how to parse HTML in VBA using Microsoft HTML object library. This includes practical example where we parse Hacker News homepage.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\" \/>\n<meta property=\"og:site_name\" content=\"Coding is Love\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/codingislove\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ranjithkumar10\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-11T06:45:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-11T08:15:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codingislove.com\/wp-content\/uploads\/2015\/12\/codinglovenew.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"225\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ranjith kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"http:\/\/i.imgur.com\/LOpqTIL.png\" \/>\n<meta name=\"twitter:creator\" content=\"@codingislove\" \/>\n<meta name=\"twitter:site\" content=\"@codingislove\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ranjith kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\"},\"author\":{\"name\":\"Ranjith kumar\",\"@id\":\"https:\/\/codingislove.com\/#\/schema\/person\/ecb142505163b016d59bfbe662af587e\"},\"headline\":\"Parse HTML in Excel VBA &#8211; Learn by parsing hacker news home page (Updated 2022)\",\"datePublished\":\"2022-09-11T06:45:27+00:00\",\"dateModified\":\"2022-09-11T08:15:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\"},\"wordCount\":880,\"commentCount\":45,\"publisher\":{\"@id\":\"https:\/\/codingislove.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png\",\"keywords\":[\"Excel\",\"VBA\",\"Web scraping\"],\"articleSection\":[\"Coding Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\",\"url\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\",\"name\":\"Parse HTML in Excel VBA - Learn by parsing hacker news home page\",\"isPartOf\":{\"@id\":\"https:\/\/codingislove.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png\",\"datePublished\":\"2022-09-11T06:45:27+00:00\",\"dateModified\":\"2022-09-11T08:15:33+00:00\",\"description\":\"A detailed tutorial on how to parse HTML in VBA using Microsoft HTML object library. This includes practical example where we parse Hacker News homepage.\",\"breadcrumb\":{\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage\",\"url\":\"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png\",\"contentUrl\":\"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png\",\"width\":940,\"height\":788},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Coding is Love\",\"item\":\"https:\/\/codingislove.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Coding Tutorials\",\"item\":\"https:\/\/codingislove.com\/category\/tutorials\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Parse HTML in Excel VBA &#8211; Learn by parsing hacker news home page (Updated 2022)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codingislove.com\/#website\",\"url\":\"https:\/\/codingislove.com\/\",\"name\":\"Coding is Love\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/codingislove.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codingislove.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codingislove.com\/#organization\",\"name\":\"Coding is Love\",\"url\":\"https:\/\/codingislove.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codingislove.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/codingislove.com\/wp-content\/uploads\/2015\/12\/codinglovenew.png\",\"contentUrl\":\"https:\/\/codingislove.com\/wp-content\/uploads\/2015\/12\/codinglovenew.png\",\"width\":300,\"height\":225,\"caption\":\"Coding is Love\"},\"image\":{\"@id\":\"https:\/\/codingislove.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/codingislove\/\",\"https:\/\/x.com\/codingislove\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codingislove.com\/#\/schema\/person\/ecb142505163b016d59bfbe662af587e\",\"name\":\"Ranjith kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codingislove.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f5486247269539c638227e6213187139cc7460eeb16d789fa757485f1d2b87f0?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f5486247269539c638227e6213187139cc7460eeb16d789fa757485f1d2b87f0?s=96&d=wavatar&r=g\",\"caption\":\"Ranjith kumar\"},\"description\":\"A CA- by education, self taught coder by passion, loves to explore new technologies and believes in learn by doing.\",\"sameAs\":[\"https:\/\/www.facebook.com\/ranjithkumar10\",\"https:\/\/www.instagram.com\/livin_on_d_edge\/\",\"https:\/\/www.linkedin.com\/in\/ranjithkumar10\",\"https:\/\/www.youtube.com\/c\/codingislove01\"],\"url\":\"https:\/\/codingislove.com\/author\/ranjithkumar10\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Parse HTML in Excel VBA - Learn by parsing hacker news home page","description":"A detailed tutorial on how to parse HTML in VBA using Microsoft HTML object library. This includes practical example where we parse Hacker News homepage.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/","og_locale":"en_US","og_type":"article","og_title":"Parse HTML in Excel VBA - Learn by parsing hacker news home page","og_description":"A detailed tutorial on how to parse HTML in VBA using Microsoft HTML object library. This includes practical example where we parse Hacker News homepage.","og_url":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/","og_site_name":"Coding is Love","article_publisher":"https:\/\/facebook.com\/codingislove\/","article_author":"https:\/\/www.facebook.com\/ranjithkumar10","article_published_time":"2022-09-11T06:45:27+00:00","article_modified_time":"2022-09-11T08:15:33+00:00","og_image":[{"width":300,"height":225,"url":"https:\/\/codingislove.com\/wp-content\/uploads\/2015\/12\/codinglovenew.png","type":"image\/png"}],"author":"Ranjith kumar","twitter_card":"summary_large_image","twitter_image":"http:\/\/i.imgur.com\/LOpqTIL.png","twitter_creator":"@codingislove","twitter_site":"@codingislove","twitter_misc":{"Written by":"Ranjith kumar","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#article","isPartOf":{"@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/"},"author":{"name":"Ranjith kumar","@id":"https:\/\/codingislove.com\/#\/schema\/person\/ecb142505163b016d59bfbe662af587e"},"headline":"Parse HTML in Excel VBA &#8211; Learn by parsing hacker news home page (Updated 2022)","datePublished":"2022-09-11T06:45:27+00:00","dateModified":"2022-09-11T08:15:33+00:00","mainEntityOfPage":{"@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/"},"wordCount":880,"commentCount":45,"publisher":{"@id":"https:\/\/codingislove.com\/#organization"},"image":{"@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage"},"thumbnailUrl":"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png","keywords":["Excel","VBA","Web scraping"],"articleSection":["Coding Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codingislove.com\/parse-html-in-excel-vba\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/","url":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/","name":"Parse HTML in Excel VBA - Learn by parsing hacker news home page","isPartOf":{"@id":"https:\/\/codingislove.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage"},"image":{"@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage"},"thumbnailUrl":"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png","datePublished":"2022-09-11T06:45:27+00:00","dateModified":"2022-09-11T08:15:33+00:00","description":"A detailed tutorial on how to parse HTML in VBA using Microsoft HTML object library. This includes practical example where we parse Hacker News homepage.","breadcrumb":{"@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codingislove.com\/parse-html-in-excel-vba\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#primaryimage","url":"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png","contentUrl":"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png","width":940,"height":788},{"@type":"BreadcrumbList","@id":"https:\/\/codingislove.com\/parse-html-in-excel-vba\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Coding is Love","item":"https:\/\/codingislove.com\/"},{"@type":"ListItem","position":2,"name":"Coding Tutorials","item":"https:\/\/codingislove.com\/category\/tutorials\/"},{"@type":"ListItem","position":3,"name":"Parse HTML in Excel VBA &#8211; Learn by parsing hacker news home page (Updated 2022)"}]},{"@type":"WebSite","@id":"https:\/\/codingislove.com\/#website","url":"https:\/\/codingislove.com\/","name":"Coding is Love","description":"","publisher":{"@id":"https:\/\/codingislove.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codingislove.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codingislove.com\/#organization","name":"Coding is Love","url":"https:\/\/codingislove.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codingislove.com\/#\/schema\/logo\/image\/","url":"https:\/\/codingislove.com\/wp-content\/uploads\/2015\/12\/codinglovenew.png","contentUrl":"https:\/\/codingislove.com\/wp-content\/uploads\/2015\/12\/codinglovenew.png","width":300,"height":225,"caption":"Coding is Love"},"image":{"@id":"https:\/\/codingislove.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/codingislove\/","https:\/\/x.com\/codingislove"]},{"@type":"Person","@id":"https:\/\/codingislove.com\/#\/schema\/person\/ecb142505163b016d59bfbe662af587e","name":"Ranjith kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codingislove.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f5486247269539c638227e6213187139cc7460eeb16d789fa757485f1d2b87f0?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f5486247269539c638227e6213187139cc7460eeb16d789fa757485f1d2b87f0?s=96&d=wavatar&r=g","caption":"Ranjith kumar"},"description":"A CA- by education, self taught coder by passion, loves to explore new technologies and believes in learn by doing.","sameAs":["https:\/\/www.facebook.com\/ranjithkumar10","https:\/\/www.instagram.com\/livin_on_d_edge\/","https:\/\/www.linkedin.com\/in\/ranjithkumar10","https:\/\/www.youtube.com\/c\/codingislove01"],"url":"https:\/\/codingislove.com\/author\/ranjithkumar10\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/codingislove.com\/wp-content\/uploads\/2016\/11\/LOpqTIL1.png","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/posts\/909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/comments?post=909"}],"version-history":[{"count":1,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/posts\/909\/revisions"}],"predecessor-version":[{"id":3945,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/posts\/909\/revisions\/3945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/media\/2690"}],"wp:attachment":[{"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/media?parent=909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/categories?post=909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codingislove.com\/wp-json\/wp\/v2\/tags?post=909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}