title: Using Pre-Made Stringbuilder Class
body: <p>I am trying to learn how to use stringbuilder functions in VBA, but am having trouble finding resources in VBA on how to use them. I could use some help to use a pre-made stringbuilder class.</p>
  
  <p>I do know that each of these subs play some role in writing a final code. For example, I have seen other examples that use <code>"string.append"</code> but I am not sure if that is how it works in this case. I could use a little bit of insight into how to utilize this code. Please help!</p>
  
  <p>The best way for me to understand is if someone can throw together a few lines of sample code using this example stringbuilder class. Thank you!!</p>
  
  <pre><code>Private m_arrBuffer
  Private m_strDelimiter
  Private Sub Class_Initialize()
      m_arrBuffer = Array()
      m_strDelimiter = “”
  End Sub
  
  Private Sub Class_Terminate()
      m_arrBuffer = Empty
  End Sub
  
  Public Property Get Delimiter()
      Delimiter = m_strDelimiter
  End Property
  
  Public Property Let Delimiter(strDelimiter)
      m_strDelimiter = strDelimiter
  End Property
  
  Public Sub Append(strValue)
      ReDim Preserve m_arrBuffer(UBound(m_arrBuffer) + 1)
      m_arrBuffer(UBound(m_arrBuffer)) = strValue
  End Sub
  
  Public Sub AppendLine(strValue)
      Me.Append strValue &amp; vbCrLf
  End Sub
  
  Public Sub Compact()
      If Not Me.Delimiter = “” Then
          strOriginalDelimiter = Me.Delimiter
          Me.Delimiter = “”
      End If
      strTemp = Me.ToString
      m_arrBuffer = Array()
      Me.Append strTemp
      Me.Delimiter = strOriginalDelimiter
  End Sub
  
  Public Function ToArray()
      ToArray = m_arrBuffer
  End Function
  
  Public Function ToString()
      ToString = Join(m_arrBuffer, m_strDelimiter)
  End Function
  </code></pre>