ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating #codes (https://www.excelbanter.com/excel-programming/373681-creating-codes.html)

[email protected]

Creating #codes
 
I am trying to turn email addresses into #Code strings, in order to
stop bots from harvesting them....

To this end I have created the following UDF but the Excel function
"Code() is not accepted. Placing "Application." in front of the word
code does not work either.


Function Hash(s) As String
strL = Len(s)
For i = 1 To strL
'--Hash = Hash & "&#" & Application.Code(Mid(s, i, 1)) & ";"
'--Hash = Hash & "&#" & Code(Mid(s, i, 1)) & ";"
Hash = Hash & "&#" & Mid(s, i, 1) & ";"
Next i
End Function

Any ideas?

Geoff


Dave Peterson

Creating #codes
 
Like:

Hash = Hash & "&#" & Asc(Mid(s, i, 1)) & ";"

?????

wrote:

I am trying to turn email addresses into #Code strings, in order to
stop bots from harvesting them....

To this end I have created the following UDF but the Excel function
"Code() is not accepted. Placing "Application." in front of the word
code does not work either.

Function Hash(s) As String
strL = Len(s)
For i = 1 To strL
'--Hash = Hash & "&#" & Application.Code(Mid(s, i, 1)) & ";"
'--Hash = Hash & "&#" & Code(Mid(s, i, 1)) & ";"
Hash = Hash & "&#" & Mid(s, i, 1) & ";"
Next i
End Function

Any ideas?

Geoff


--

Dave Peterson

[email protected]

Creating #codes
 
Thanks Dave....

It works a treat....

Geoff

Dave Peterson wrote:
Like:

Hash = Hash & "&#" & Asc(Mid(s, i, 1)) & ";"

?????

wrote:

I am trying to turn email addresses into #Code strings, in order to
stop bots from harvesting them....

To this end I have created the following UDF but the Excel function
"Code() is not accepted. Placing "Application." in front of the word
code does not work either.

Function Hash(s) As String
strL = Len(s)
For i = 1 To strL
'--Hash = Hash & "&#" & Application.Code(Mid(s, i, 1)) & ";"
'--Hash = Hash & "&#" & Code(Mid(s, i, 1)) & ";"
Hash = Hash & "&#" & Mid(s, i, 1) & ";"
Next i
End Function

Any ideas?

Geoff


--

Dave Peterson




All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com