Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The double loop I posted processed char codes 65-90 and 97-122, ie A-Z,a-z.
Even with the limited information and typo you posted it appeared to successfully decode your sample string. If it fails to decode different sample data, it's impossible for anyone to assist without that data, and ideally what the sample should decode as (doesn't look like it's encrypted). Regards, Peter T "Dudely" wrote in message ... Yes, the typo was in the post, not in the original code. I didn't quite understand what you were doing, so I changed your code a bit to: For i = 48 To 127 sfind = Replace("&#num;", "num", CStr(i)) Subject = Replace(Subject, sfind, Chr$(i)) Next which I believe captures the essence of what you were doing. The target string could be almost anything and must be able to handle any character. For the moment, I'm assuming the ASCII character set to be sufficient, but in truth there's nothing to prevent someone from using alphanum characters outside that range as well. In any event, while the sample string works, live data continues to fail. What I'd prefer to do, is setup a "capture", because it walks through a LOT of data before it gets to one of these encoded text strings and I'd rather not have to check every single iteration to see if it has one of the target strings. What I mean is that instead of trying to fix it first, I'd prefer to find and capture the text. Then later a similar method can be used to replace the target string. So instead of the above, it might say something like: if inStr(1, Subject, "&#") then msgBox "Found " + Subject endif Something like that. Note, that I tried something like that and it also failed. Thank you most kindly for your help. - Dudely On Nov 11, 12:18 am, "Peter T" <peter_t@discussions wrote: Looks like you have a typo, 66 vs 65 Try this too - Sub test() Dim i As Long, j As Long, k As Long Dim Subject As String Subject = "Auction" For j = 0 To 1 k = 32 * j For i = 65 To 65 + 26 sfind = Replace("&#num;", "num", CStr(i + k)) Subject = Replace(Subject, sfind, Chr$(i + k)) Next Next MsgBox Subject ' Auction End Sub Regards, Peter T "Dudely" wrote in message ... I pull a text string off a web page, that contains some random text. From time to time, the string will contain a mixture of ASCII and ISO encoded characters. Sample below. I'm unable to get any function to recognize the string. I'm using VBA 6.0 with Excel 2000 Example code: Subject= "Auction" Subject = Replace(Subject, "B", "A") I've also tried every other character that should be in that string. The replacement never takes place, the string is unmodified. I've also tried searching for just "&#" but it never finds that either. I've tried using InStr as well but that fails to find a match too. The goal is of course to dechiper the (random) string into it's ASCII equivalent (so that it can be read by a human). Any help? Thank you in advance - Dudely- Hide quoted text - - Show quoted text - |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to create dialog box that will post to worksheet encoded data? | Excel Discussion (Misc queries) | |||
Excel docs opening encoded | Excel Discussion (Misc queries) | |||
Opening UTF8-encoded CSV file (Excel 2004 for Mac) | Excel Discussion (Misc queries) | |||
How to open a UTF-8 encoded CSV file in Excel | Excel Discussion (Misc queries) | |||
Importing UTF-8 Encoded CSV Files. Problem | Excel Programming |