Hey, check out the following function. I did some testing on it and I think it could be a little faster. Now I don't know what else I can do to make it faster. I tried replacing the StrConv function to CopyMemoryStringToAny, and that did VERY LITTLE difference on a 100000 loop (like 100 ms at the most). Is there a better way to do it all together?

VB Code:
  1. Public Function UrlEncode(ByVal urlText As String) As String
  2.     Dim ANSI() As Byte
  3.     Dim ASCII As Long
  4.     Dim encText As String
  5.     Dim I As Long
  6.    
  7.     On Error GoTo UrlEncode_Error
  8.    
  9.     ANSI = StrConv(urlText, vbFromUnicode)
  10.    
  11.     For I = 0 To UBound(ANSI)
  12.         ASCII = (ANSI(I) + 2) Mod 256   'Roll over back to 0 past 255, else HEX and CHR won't work
  13.        
  14.         Select Case ASCII
  15.             Case 48 To 57, 65 To 90, 97 To 122  'Letters and Numbers
  16.                 encText = encText & Chr(ASCII)
  17.                
  18.             Case 32     'Spaces
  19.                 encText = encText & "+"
  20.                
  21.             Case 0 To 16    'Low Hex characters
  22.                 encText = encText & "%0" & Hex(ASCII)
  23.                
  24.             Case Else   'Special Characters
  25.                 encText = encText & "%" & Hex(ASCII)
  26.         End Select
  27.     Next I
  28.      
  29.     UrlEncode = encText
  30.    
  31.     Exit Function
  32.  
  33. UrlEncode_Error:
  34.     MsgBox "Error #:" & Err.Number & vbCrLf & "Procedure [UrlEncode] of Module [mNetFunctions]" & vbCrLf & "Description: " & Err.Description, vbOKOnly, "Error Handling"
  35. End Function