View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Cannot Dechiper Encoded String

On Sun, 16 Nov 2008 09:00:24 -0800 (PST), Dudely wrote:

The string value of el is composed of letters & numbers that make up
an email address, +1. It comes in the form of: *@*.* and is composed
of a random number of characters followed by ?subject= followed by the
actual subject string. The value of theSpot is equal to the number of
characters in the email address. If in fact the email address were
, then the corresponding values would be:

?subject=B ank
Seized
theSpot=the number of characters between the start of the value and
the word "subject" and is obtained by the expression: theSpot = InStr
(el, "subject")
The subject string=Bank Seized


I suspect something odd about the code you have not posted. Perhaps if you
posted all of your code, and not just bits and pieces, it might be helpful.

The following seems to work as expected:

=====================
Option Explicit
Const e1 As String = _
?subject=Bank Seized"

Sub foo()
Dim SubjectString As String
Dim i As Long
Dim theSpot As Long
theSpot = InStr(e1, "subject")
SubjectString = Mid(e1, theSpot + 8)

For i = 32 To 127
SubjectString = Replace(SubjectString, "&#" & i & ";", Chr(i))
Next i

Debug.Print SubjectString

End Sub
====================
--ron