Mask URL's in your source code

drigger

Newbie
Joined
Jun 4, 2008
Messages
40
Reaction score
28
Hi all,

Looks like you can't upload xls files here. Here's a VBA macro I wrote that converts my URL's to hex. Feel free to use it as you wish; I use it to create links to be illigible when you view source.

I'm no programmer so the code must look horrible, but it serves it's purpose. Type your URL including http:// in B2, enter =trim(B2) in B3, then run the macro below. Your new URL shows in B8

Code:
Sub CreateObscure()
Dim myURL(10000) As String
Dim theURL As String
Dim temp As Integer
Dim word As String
For i = 8 To Len(Range("B3").Value)
    Range("B5").Select
    ActiveCell.FormulaR1C1 = "=DEC2HEX(CODE(MID(R[-2]C," & i & ",1)))"
 
    If ActiveCell.Value = "2F" Then
        myURL(i) = "/"
 
    ElseIf ActiveCell.Value = "3D" Then
            myURL(i) = "="
 
    ElseIf ActiveCell.Value = "3F" Then
            myURL(i) = "?"
    Else
 
    myURL(i) = "%" & ActiveCell.Value
 
    End If
 
Next i
 
    theURL = Join(myURL, "")
    theURL = "http://" & theURL
 
    Range("B7").Value = theURL
 
End Sub
 
Back
Top