Optional object parameter

C

Carol G

I am trying to check if an object argument was passed to a sub.
See below... I get an error message at "If itm <> vbNull "
how do I check if an object was passed from the calling function?

Thanks,
Carol

Sub Envelope(Optional itm As ContactItem)
If itm <> vbNull Then 'Trying to see if item sent
Debug.Print "Item class: " & itm.Class
Debug.Print itm.FullName
If itm.Class <> olContact Then
MsgBox "The active Inspector is not a contact item; exiting"
Exit Sub
End If
 
S

Sue Mosher [MVP-Outlook]

If Not itm Is Nothing Then

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Carol G

Thanks,
Carol
If Not itm Is Nothing Then

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top