title: Microsoft Visual Basic: how to initialize an array variable?
body: <p>I wrote a macro which performs certain operations on every instance of a specific set of Word Styles within a document.  </p>
  
  <p>To do so,  I created an array of names this way:</p>
  
  <pre><code>Dim mylist(4) As String
  mylist(1) = "Heading 1" 
  mylist(2) = "Heading 2" 
  mylist(3) = "Heading 3" 
  mylist(4) = "Caption"
  </code></pre>
  
  <p>I was unable to find any help pages (inside Office Help or at microsoft.com) which mentioned a shorter way to do so.  Is there any syntax that would let me simplify this into something like (pseudocode)</p>
  
  <pre><code>mylist(1:4) = ["Heading 1", "Heading 2", "Heading 3", "Caption"]
  </code></pre>
  
  <p>I'm looking for a general solution for one-line loading of an array, whether it's strings or numbers, when I don't want the entire collection of something like, say <strong>all</strong> styles in a document.</p>
  
  <p>EDIT:  I ran across <a href="https://stackoverflow.com/questions/85892/collection-initialization-syntax-in-visual-basic-2008?rq=1">Collection initialization syntax in Visual Basic 2008?</a>, which suggests the answer is "not until VB10" .  Any updates to that conclusion would be welcome.</p>