Use VbNullString instead of
Request a callback

We'll call during UK business hours

0207 987 3777

Hints and tips home » VBA hints and tips » Use VbNullString instead of

Use VbNullString instead of

When needing to default a String variable back to it's default of "" use vbNullString as in the following example:

Sub ClearText()

Dim strEmpName As String

strEmpName = "John Smith"
MsgBox strEmpName

strEmpName = vbNullString
MsgBox strEmpName

End Sub

Added by Carlos on 8th December 2006

More VBA hints and tips, like:

Management Training courses London
Course rating
4.6 stars - based on 153 reviews
Microsoft Certified Partner Institute of Leadership and Management - Certified Courses Learning and Performance Institute - Accredited Training Provider Security Seal verified by visa, mastercard securecard

Connect with us: Google+ · Facebook · Twitter · LinkedIn · Pinterest

2nd Floor, CA House, 1 Northey Street
Limehouse Basin, London, E14 8BT
United Kingdom