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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Need to verify TO recipient



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 19th 06, 07:45 PM posted to microsoft.public.outlook.program_forms
[email protected]
external usenet poster
 
Posts: 12
Default Need to verify TO recipient

Hello All,

When the user hits send on a custom mail item I have created, I want to make
sure a specific email address is in the To recipient line. How can I do
this? I have tried the code below, but I do not think I am even on the right
track.

Function Item_Send()
dim txt,pos
Set txt = Item.Recipient.Value
'A textual comparison starting at position 4
pos = InStr(txt,"Riley, Jeff",1)
If pos = 0 Then
Item.Recipient.Value = "Riley, Jeff (MVC)" & txt
End If
End Function

Thank you,
Jeff Riley
  #2  
Old April 19th 06, 10:38 PM posted to microsoft.public.outlook.program_forms
Hollis Paul [MVP - Outlook]
external usenet poster
 
Posts: 138
Default Need to verify TO recipient

In article ,
=?Utf-8?B?amVmZi5yaWxleUBicC5jb20=?= wrote:
Item.Recipient.Value = "Riley, Jeff (MVC)" & txt

It appears that what you are trying to do here is give it to
addressees--Jeff and whoever was in txt. You can't do it that way.
You need to create a new recipient object, add Jeff... To that as a
value. Be sure to set the type properly.

--
Hollis Paul
Mukilteo, WA USA


  #3  
Old April 19th 06, 07:49 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Need to verify TO recipient

You're on the right track, but the key point that you've missed is that there is no Recipient field. Think about it: An item can have multiple recipients. So, you need to check each one:

Function Item_Send()
Dim blnOKToSend
blnOKToSend = False
For Each recip in Item.Recipients
If recip.Address = " Then
blnOKToSend = True
Exit For
End If
Next
Item_Send = blnOKToSend
End Function

--
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

" wrote in message ...
Hello All,

When the user hits send on a custom mail item I have created, I want to make
sure a specific email address is in the To recipient line. How can I do
this? I have tried the code below, but I do not think I am even on the right
track.

Function Item_Send()
dim txt,pos
Set txt = Item.Recipient.Value
'A textual comparison starting at position 4
pos = InStr(txt,"Riley, Jeff",1)
If pos = 0 Then
Item.Recipient.Value = "Riley, Jeff (MVC)" & txt
End If
End Function

Thank you,
Jeff Riley

 




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
how do you verify credentials roger Outlook - Calandaring 1 March 2nd 06 04:13 PM
Variable attachment and recipient vb Xluser@work Outlook and VBA 1 January 21st 06 09:05 AM
If I use OMA can I verify the size of my mailbox Jay Outlook - General Queries 0 January 20th 06 09:44 AM
Using OWA how can I easily verify the size of my mailbox Jay Outlook - General Queries 2 January 20th 06 09:38 AM
using Send To, Mail Recipient Martin Outlook and VBA 3 January 16th 06 04:30 PM


All times are GMT +1. The time now is 04:35 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.