Attribute VB_Name = "udf_isNothing" '------------------------------------------------------------------------------- 'File : udf_isNothing.bas ' Copyright mpl by ERB software ' All rights reserved ' http://wiki.yaslaw.info/dokuwiki/doku.php/vba/cast/strtodate 'Environment : VBA 2007 + 'Version : 1.0.3 'Name : _isNothing 'Author : Stefan Erb (ERS) 'History : 30.04.2014 - ERS - Creation ' 11.07.2018 - ERS - Leerer Array mit IsMissing prüfen ' 03.09.2018 - ERS - Korrektur bei isMissing '------------------------------------------------------------------------------- Option Explicit '/** ' * Prüft, ob eine Variable Null, Empty, Nothing, Leerstring, leerer Array etc ist ' * ' * boolean = isNothing(object) ' * boolean = isNothing(vaule) ' * ' * @param Variant Variable die geprüft werden soll ' * @return Boolean ' */ Public Function isNothing(ByRef iValue As Variant) As Boolean isNothing = True Select Case TypeName(iValue) Case "Nothing", "Empty", "Null": Exit Function Case "Collection", "Dictionary": If iValue.count = 0 Then Exit Function Case "String": If Len(trim(iValue)) = 0 Then Exit Function Case "Iterator": If Not iValue.isInitialized Then Exit Function '//TODO: weitere Spezialfälle Case Else: If IsArray(iValue) Or IsMissing(iValue) Then Exit Function End Select isNothing = False End Function