title: How to Dim a getElementsBy* result
body: <p>I am doing some internet searching from VBA, and at one point I have the line </p>
  
  <pre><code>Set valueResult = currPage.getElementById("rg_s").getElementsByTagName("IMG")
  </code></pre>
  
  <p>where <code>currPage</code> is declared as an <code>HTMLDocument</code></p>
  
  <p>and I'm wondering how to <code>Dim</code> <code>valueResult</code> to achieve:</p>
  
  <ol>
  <li>IntelliSense (vba's autocomplete) results</li>
  <li>Better execution times (by using a specific rather than default <code>Variant</code> type)</li>
  </ol>
  
  <p>When I look at the Locals window, I'm told that <code>Set</code> gives it the 
   <code>DispHTMLElementCollection</code> type, but that's not an option when I <code>Dim</code>. I've <a href="https://what.thedailywtf.com/topic/5918/completely-undocumented-dom-class-disphtmlelementcollection/3" rel="nofollow noreferrer">read</a> that <code>getElementsBy*</code> actually returns a <a href="https://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177" rel="nofollow noreferrer"><code>Node List</code></a> as opposed to an array, so I've been trying to follow that avenue, but can't find anything VBA specific.</p>
  
  <p><strong>So how should I declare it?</strong> - at the moment I've just got <code>Dim valueResult As Object</code> but that's hardly better than <code>Variant</code> and doesn't give IntelliSense prompts.</p>
  
  <p><em>NB. I have Microsoft HTML Object Library ticked</em></p>