title: Get last element of string array in vb6?
body: <p>How might one retrieve the last element of a string array in visual basic 6?</p>
  
  <p>I'm dealing with filenames with multiple dots which are split into an array, and I want to manipulate only the extension. The following code works, but has a hardcoded element I want to remove.</p>
  
  <pre><code>Private Sub Form_Load()
      Dim aPath() As String
      Dim FileName As String
      Dim realExt As String
  
      FileName = "A long dotty.file.name.txt"
      aPath = Split(FileName, ".")
  
      realExt = aPath(3) ' &lt;-- how to not hardcode?'
  
      MsgBox ("The real extension is: " &amp; realExt)
      Unload Me
  End Sub
  </code></pre>