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:

Training courses
London & UK

Live dates & prices »

On-site training

Get a quote »


rssRSS feeds

What's this?

All hints and tips:

RSS feed

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

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