comma separators after hex conversion?

jklein

New Member
Joined
May 12, 2002
Messages
7
Hi all,
I'm using a VB hex conversion module I found on Mr Excel that's working well, but I can't figure out how to put separators in between each two hex characters. I need to paste the results into a txt file that requires the comma separators. I did find one webpage that puts % between every two characters, which then allows me to use the find/replace function, but if there's a way to put a % in there I would think a comma is possible, too.

The VB script I'm using is:
Function WEPConv(str As String) As String
Dim i As Long
For i = 1 To Len(str)
WEPConv = WEPConv & Hex(Asc(Mid(str, i, 1)))
Next i
End Function

The html-based hex conversion web page I'm referencing is:
http://www.mikezilla.com/exp0012.html

Thanks for any suggestions,
Jeff K.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Like this?

Code:
Function WEPConv(str As String) As String
    Dim i As Long
    For i = 1 To Len(str)
        If i = 1 Then
            WEPConv = Hex(Asc(Mid(str, i, 1)))
        Else
            WEPConv = WEPConv & "," & Hex(Asc(Mid(str, i, 1)))
        End If
    Next i
End Function
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top