Hex-functie

Geeft een tekenreeks terug die de hexadecimale waarde van een getal voorstelt.

Syntaxis:

Hex (Getal)

Teruggegeven waarde:

String

Parameters:

Getal: Elke numerieke expressie die moet worden geconverteerd naar een hexadecimaal getal.

Foutcodes:

5 Ongeldige aanroep van procedure

Voorbeeld:

Sub ExampleHex

' gebruikt BASIC-formules in LibreOffice Calc

Dim a2, b2, c2 As String

    a2 = "&H3E8"

    b2 = Hex2Int(a2)

    MsgBox b2

    c2 = Int2Hex(b2)

    MsgBox c2

End Sub

 

Function Hex2Int( sHex As String ) As Long

' Geeft een Long Integer-waarde van een hexadecimale waarde terug.

    Hex2Int = clng( sHex )

End Function

 

Function Int2Hex( iLong As Long) As String

' Berekent een hexadecimale waarde in Integer.

    Int2Hex = "&H" & Hex( iLong )

End Function