Use VbNullString instead of

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