Public Function UnsignedToLong(Value As Double) As Long ' 'The function takes a Double containing a value in the 'range of an unsigned Long and returns a Long that you 'can pass to an API that requires an unsigned Long ' If Value < 0 Or Value >= OFFSET_4 Then Error 6 ' Overflow ' If Value <= MAXINT_4 Then UnsignedToLong = Value Else UnsignedToLong = Value - OFFSET_4 End If 'End Function

Public Function LongToUnsigned(Value As Long) As Double ' 'The function takes an unsigned Long from an API and 'converts it to a Double for display or arithmetic purposes ' If Value < 0 Then LongToUnsigned = Value + OFFSET_4 Else LongToUnsigned = Value End If 'End Function

Public Function UnsignedToInteger(Value As Long) As Integer ' 'The function takes a Long containing a value in the range 'of an unsigned Integer and returns an Integer that you 'can pass to an API that requires an unsigned Integer ' If Value < 0 Or Value >= OFFSET_2 Then Error 6 ' Overflow ' If Value <= MAXINT_2 Then UnsignedToInteger = Value Else UnsignedToInteger = Value - OFFSET_2 End If 'End Function

Public Function IntegerToUnsigned(Value As Integer) As Long ' 'The function takes an unsigned Integer from and API and 'converts it to a Long for display or arithmetic purposes ' If Value < 0 Then IntegerToUnsigned = Value + OFFSET_2 Else IntegerToUnsigned = Value End If 'End Function