What I have is code that takes data that is converted to base64 and spans it to 75 characters and a vbCrLf per line. Here is the code including the variables for that:

VB Code:
  1. Public Sub Span(bIn() As Byte, bOut() As Byte, Optional sBreak As String = vbCrLf)
  2. Dim i As Long
  3. Dim sLong As String
  4. Dim sSpan As String
  5. Dim sLineBreak As String
  6. Dim lLineLength As Long
  7.  
  8.     ' change these parts to alter the character
  9.     ' used for the line break
  10.     sLineBreak = sBreak
  11.     lLineLength = 76 - Len(sLineBreak)
  12.  
  13.     ' firstly convert the array to a string
  14.     ' this makes the whole operation much easier
  15.     sLong = StrConv(bIn, vbUnicode)
  16.    
  17.     ' now add the line breaks
  18.     i = 1
  19.    
  20.     For i = 1 To Len(sLong) Step lLineLength
  21.         ' collect 75 chars and add a vbCrLf
  22.         sSpan = sSpan & Mid$(sLong, i, lLineLength) & vbCrLf
  23.     Next i
  24.    
  25.     ' convert back into a byte array
  26.     bOut = StrConv(sSpan, vbFromUnicode)
  27.    
  28. End Sub

The problem is that it takes more than four or five minutes to span data that is around 600kb. This code is all in a module and the language is VB6. How can I do this faster?