View Single Post
  #1  
Old January 1st 07, 09:53 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Optional object parameter


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


Ads