Public Function yDecode(sString As String) As String
Dim bOut() As Byte, bIn() As Byte, bTest As Byte, bEscaped As Boolean, lPos As Long, lChar As Long
sString = Replace(sString, vbCr, vbNullString) 'Get rid of the vbCrLfs. These could be in...
sString = Replace(sString, vbLf, vbNullString) 'either order.
bIn = StrConv(sString, vbFromUnicode) 'Load the input byte array.
ReDim bOut(UBound(bIn)) 'There is no case where the output will be larger.
For lChar = 0 To UBound(bIn)
If bIn(lChar) <> 61 Then
bTest = ((bIn(lChar) + 256) - 42) Mod 256
If bEscaped Then
bTest = ((bTest + 256) - 64) Mod 256
bEscaped = False
End If
bOut(lPos) = bTest
lPos = lPos + 1
Else
bEscaped = True
End If
Next lChar
ReDim Preserve bOut(lPos - 1) 'Truncate the unused portion of the buffer.
yDecode = StrConv(bOut, vbUnicode) 'Convert back to a string and return.
End Function