A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Optional object parameter



 
 
Thread Tools Search this Thread Display Modes
  #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


  #2  
Old January 1st 07, 10:45 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Optional object parameter

If Not itm Is Nothing Then

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Carol G" wrote in message news:bxemh.549535$R63.136085@pd7urf1no...

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


  #3  
Old January 2nd 07, 02:10 AM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Optional object parameter

Thanks,
Carol
"Sue Mosher [MVP-Outlook]" wrote in message
...
If Not itm Is Nothing Then

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Carol G" wrote in message
news:bxemh.549535$R63.136085@pd7urf1no...

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




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook should offer optional Exit confirmation dialog D Major Guy Outlook - Installation 4 May 24th 07 12:56 AM
Creating signatures but leaving them optional PeterJordan Outlook - General Queries 1 December 23rd 06 04:35 PM
how do i make the chedule an optional meeting? Sean Outlook - Using Contacts 1 August 3rd 06 03:46 AM
Scope Parameter for AdvancedSearch Renjith Outlook - Using Contacts 1 May 12th 06 03:42 PM
invalid parameter value Mexrick Outlook - Using Contacts 0 March 21st 06 06:37 AM


All times are GMT +1. The time now is 07:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.