Does anybody know "IsNothing()"? 
Author Message
 Does anybody know "IsNothing()"?

Hi there,
I've got the problem to find out, if an object variable is
set to nothing. Word 2000 help claims that there is a
function called "IsNothing(<ObjectVar>)" which should serve
the purpose which I need, but when I write a call to
IsNothing into my VBA source, I get an error message that
"IsNothing" is unknown!

Comparing an object variable to Nothing is not possible,
either. So what can I do?

Any suggestions appreciated!

Thanks,
Daffy



Sat, 03 Jan 2004 17:44:46 GMT  
 Does anybody know "IsNothing()"?

Quote:
>-----Original Message-----
>Hi there,
>I've got the problem to find out, if an object variable is
>set to nothing. Word 2000 help claims that there is a
>function called "IsNothing(<ObjectVar>)" which should
serve
>the purpose which I need, but when I write a call to
>IsNothing into my VBA source, I get an error message that
>"IsNothing" is unknown!

>Comparing an object variable to Nothing is not possible,
>either. So what can I do?

>Any suggestions appreciated!

>Thanks,
>Daffy
>.

Okay, I found the answer to my question myself! But just
for anybody, who might have the same problem - here is the
solution:

1. The function "IsNothing" which is mentioned in the
online help, is a bug!!! (-> MS-Knowledgebase told me so)

2. To find out if an object variable is set to nothing you
can do the following:

If TypeName(<objVar>) = "Nothing" Then...

or if you want to know if an object is NOT set to nothing:
If TypeName(<objVar>) <> "Nothing" Then...



Sat, 03 Jan 2004 20:31:47 GMT  
 Does anybody know "IsNothing()"?
Can you use:

   if objectVar is Nothing then
      <do your nothing thing>
   end if


Quote:

> Hi there,
> I've got the problem to find out, if an object variable is
> set to nothing. Word 2000 help claims that there is a
> function called "IsNothing(<ObjectVar>)" which should serve
> the purpose which I need, but when I write a call to
> IsNothing into my VBA source, I get an error message that
> "IsNothing" is unknown!

> Comparing an object variable to Nothing is not possible,
> either. So what can I do?

> Any suggestions appreciated!

> Thanks,
> Daffy

--

ROT13 encoding, decode for real mail


Sat, 03 Jan 2004 20:36:01 GMT  
 Does anybody know "IsNothing()"?
Either you are misreading the "help" text or the text has typos!

There is no "IsNothing" function.
You do have the "IS" operator to do a boolean comparison between objects.
You also have the "NOTHING" or unassigned object to work with.

If you would like to have an "IsNothing" function, you could write it thus:

Public Function IsNothing(gizmo As Object) As Boolean
' Returns TRUE if the object (gizmo) is unassigned.
Dim test As Boolean
Begin
    t = (gizmo IS NOTHING)
    IsNothing = t
End Function

Thomas Bartkus


Quote:
> Hi there,
> I've got the problem to find out, if an object variable is
> set to nothing. Word 2000 help claims that there is a
> function called "IsNothing(<ObjectVar>)" which should serve
> the purpose which I need, but when I write a call to
> IsNothing into my VBA source, I get an error message that
> "IsNothing" is unknown!

> Comparing an object variable to Nothing is not possible,
> either. So what can I do?



Sat, 03 Jan 2004 23:36:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Parsing CSV strings like "Doe, John",33, "6'2"""

2. Parsing CSV strings like "Doe, John",33, "6'2"""

3. "Not IsNothing(object)" or "object is nothing = false"

4. Anybody heard of "VISUAL-GEN"

5. Anybody heard of "VISUAL-GEN"

6. Doing "Stuff" in the background

7. Origin of "John Doe"

8. Wait until done "thinking"?

9. Wait until done "thinking"?

10. Wait until done "thinking"?

11. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

12. Doe's anybody knows how to...

 

 
Powered by phpBB® Forum Software