title: I need help converting VB.Net code to VBA
body: <p>I have inserted in a slide a listview control. In the next step I tried to display all files and folders + icons, using this code:    </p>
  
  <pre><code>For Each fileName In IO.Directory.GetFiles("C:\")
      ImageList21.Images.Add (Icon.ExtractAssociatedIcon(fileName))
      ListView31.Items.Add (system.IO.Path.GetFileName(fileName)) , _
          ImageList21.Images.Count - 1)
  Next fileName
  </code></pre>
  
  <p>It works perfectly on Visual Studio 2008, but on VBA (that uses VB6), I get loads of errors for example:</p>
  
  <blockquote>
    <p>For Each Control variable must be variant or object</p>
  </blockquote>
  
  <p>Also, this line of code is turning red and reporting an error</p>
  
  <pre><code>ListView31.Items.Add (system.IO.Path.GetFileName(fileName)) , ImageList21.Images.Count - 1)
  </code></pre>
  
  <blockquote>
    <p>Expected: end of statement</p>
  </blockquote>
  
  <p>Can anyone explain how to convert the code to VB6/VBA?</p>