ExcelVBAで文字列を16進数に変換

文字列→16進法

Private Function StrToHex(ByVal strData As String) As String '文字列→16進法
    Dim strChar As String
    ReDim strHex(1 To Len(strData)) As String
    ReDim lngNu(1 To Len(strData))
    For i = 1 To Len(strData)
        strChar = Mid$(strData, i, 1)
        strHex(i) = HEx$(Asc(strChar))
        lngNu(i) = Len(strHex(i)) '16進法の値の桁数を格納
    Next
    StrToHex = Join$(strHex, vbNullString)
End Function

Dim HexData
HexData = StrToHex(ItemName)
        
MsgBox HexData

ネタ元