MsgBox CStr(2023) ' … "2023" MsgBox Oct(2023) ' … "3747" MsgBox Hex(2023) ' … "7E7" MsgBox CStr(&O3747) ' … "2023" MsgBox Oct(&O3747) ' … "3747" MsgBox Hex(&O3747) ' … "7E7" MsgBox CStr(&H7E7) ' … "2023" MsgBox Oct(&H7E7) ' … "3747" MsgBox Hex(&H7E7) ' … "7E7"
Public Function ToHexString(ByVal Text As String, Optional ByVal Charset As String = "Shift_JIS") As String Dim x As Object, y As Object Set x = CreateObject("ADODB.Stream") x.Open x.Charset = Charset x.WriteText Text x.Position = 0 x.Type = 1 Set y = CreateObject("Msxml2.DOMDocument").createElement("x") y.DataType = "bin.hex" y.NodeTypedValue = x.Read(-1&) x.Close ToHexString = y.Text End Function