[Dba-office] Direct replacement for Nz in Word/Excel
John Bodin
jbodin at sbor.com
Thu Dec 10 08:04:57 CST 2015
very handy gustav, thanks for sharing. I still remember when I found out about NZ() in Access - wondered how I ever got by without it and I certainly use it all the time now.
________________________________________
From: Dba-office <dba-office-bounces at databaseadvisors.com> on behalf of Gustav Brock <gustav at cactus.dk>
Sent: Thursday, December 10, 2015 8:47 AM
To: dba-office at databaseadvisors.com
Subject: [Dba-office] Direct replacement for Nz in Word/Excel
Hi all
I had a need for this in Word, but couldn't find a decent solution, so here is - should you encounter the same situation:
<code>
' Replacement for Microsoft Access' function Application.Nz().
' For use in Word/Excel to eliminate the need for a reference to:
'
' Microsoft Office 15.0 Access database engine Object Library.
'
' 2015-12-10. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function Nz( _
ByRef Value As Variant, _
Optional ByRef ValueIfNull As Variant = "") _
As Variant
Dim ValueNz As Variant
If Not IsEmpty(Value) Then
If IsNull(Value) Then
ValueNz = ValueIfNull
Else
ValueNz = Value
End If
End If
Nz = ValueNz
End Function
</code>
/gustav
_______________________________________________
Dba-office mailing list
Dba-office at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-office
More information about the Dba-office
mailing list