title: Create CSV from array in VBA
body: <p>I'm a novice programmer trying to automate some repetitive workplace tasks that should be done by a clever script instead of humans. I've done some VBA and Java, but very basic stuff.</p>
  
  <p>We have some data generated by a validated online form that gets emailed to a mailbox, and then a filter in the mail client (Outlook 2010) puts it into a particular folder. My intention is to write some VBA that when triggered will check the contents of that folder, and then for each mail item, get the message body text as a string, create an array, and then write the array contents into a .csv file. I'll then have another app (iMacros for Firefox) read the csv and interact with an in-house corporate webapp to do the rest.</p>
  
  <p>I think I can do all of that except write the array contents to csv.</p>
  
  <p>I work best from looking at code examples (I do try to understand the MS Object Model documentation), but the best I can find for writing a VBA array to CSV is something like:</p>
  
  <pre><code>  'save the file
    Open sFileName For Output As #7
    For n = 0 To UBound(MyArray, 1)
      Print #7, Format(MyArray(n, 0), "0.000000E+00")
    Next n
    Close #7
  </code></pre>
  
  <p>I think this is VB and not VBA, but is the general idea here valid? Or if anyone else has a code sample to get me started or any other pointers I'd be very grateful.</p>
  
  <p>PS Have also seen <a href="https://stackoverflow.com/questions/1353325/how-do-i-save-a-2-dimensional-array-as-a-csv-file">How do I save a 2-dimensional array as a csv file?</a> but can't understand it.</p>