View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Whats the equivalent of null in VBA?

It seems that your idea that "work arounds" are required stems from your
misunderstanding the VBA/VB language and what Null means.
To me, outside of a database environment, it does not have a real meaning in
VBA, where you have Nothing for objects and Empty for variants (although you
can use Null with a Variant also) & vbNullString for strings.

Private Sub CommandButton1_Click()
Dim Nullable As Variant

Nullable = "some string"
Nullable = Null
Debug.Print IsNull(Nullable)

Nullable = "some string"
Nullable = Empty
Debug.Print IsNull(Nullable)

Dim NullStr As String
NullStr = "Null String"
NullStr = vbNullString
Debug.Print IsNull(NullStr)

End Sub

NickHK

"vivmaha" wrote in message
...
I'll try all of these work arounds. I'll only be able to test if they work
when my application is 'semi-complete'.

Why are all of these work arounds? Is there no such 'null' as there is in
other languages?

"vivmaha" wrote:

Hi,
I have the following code:
Public parent As Node
Set parent = New Node
parent = Null

This doesnt work (Error 438). The error is on the last line, where I try

to
assign a null value to parent. How do I assign null values to objects in

VBA?

Btw, "Node" is defined as a class module.

Thanks.