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:
Public Sub Span(bIn() As Byte, bOut() As Byte, Optional sBreak As String = vbCrLf) Dim i As Long Dim sLong As String Dim sSpan As String Dim sLineBreak As String Dim lLineLength As Long ' change these parts to alter the character ' used for the line break sLineBreak = sBreak lLineLength = 76 - Len(sLineBreak) ' firstly convert the array to a string ' this makes the whole operation much easier sLong = StrConv(bIn, vbUnicode) ' now add the line breaks i = 1 For i = 1 To Len(sLong) Step lLineLength ' collect 75 chars and add a vbCrLf sSpan = sSpan & Mid$(sLong, i, lLineLength) & vbCrLf Next i ' convert back into a byte array bOut = StrConv(sSpan, vbFromUnicode) 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?




Reply With Quote