Pop this into a module;
Option Explicit
Function ConvString(xStr As String) As String
Dim Dummy As Integer
ConvString = ""
For Dummy = 1 To Len(xStr)
If Mid(xStr, Dummy, 1) = "%" Then
ConvString = ConvString + Chr(HexToDec(Mid(xStr, Dummy + 1, 2)))
Dummy = Dummy + 2
Else
ConvString = ConvString + Mid(xStr, Dummy, 1)
End If
Next
End Function
Function HexToDec(xHex As String) As Integer
HexToDec = 0
HexToDec = CInt(Left(xHex, 1)) * 16
HexToDec = HexToDec + CInt(Right(xHex, 1))
End Function
then you can use the ConvString function to convert;
eg;
MyString = ConvString("Ed%20Rush%20%26%20Optical")
would return
Ed Rush & Optical
It could probably do with a bit of tweaking but it should work (providing all ascii codes that appear after the % signs are two chars long - if they aren't always you will need to fiddle around with the code a bit)
Have fun.




Reply With Quote