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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Question regarding OlMailRecipientType.OlTo / olCC / olBCC



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 18th 07, 10:23 PM posted to microsoft.public.outlook.program_addins
Steffen Grellmann
external usenet poster
 
Posts: 9
Default Question regarding OlMailRecipientType.OlTo / olCC / olBCC

Hi newsgroup,

I want to pass E-Mail-addresses from a Windows form to an
ActiveInspectors CurrentItem. I'm a little bit confused of the
handling of OlMailRecipientType: If I create a new mail item for test
purposes in Example 1, everything is going well. But if I refer to the
CurrentItem of an ActiveInspector (see Example 2) I have to fill the
olTo-Field AFTER the olCC and olBCC fields are filled. Otherwise the
e-mail-addresses are not filled in the correct fields of the
CurrentItem "mail draft" - which is working perfect in Example 1.

As you can see I found a way to handle this behaviour by filling olTo
at last, but I have no idea why this is necessary! Any ideas are
appreciated.

Kind regards,

Steffen

Example 1

Dim objOutlook As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

olNameSpace = objOutlook.GetNamespace("MAPI")
objOutlookMsg =
objOutlook.CreateItem(Outlook.OlItemType.olMailIte m)

With objOutlookMsg
objOutlookRecip = .Recipients.Add(EmailTo)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olTo

objOutlookRecip = .Recipients.Add(strCC)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olCC

objOutlookRecip = .Recipients.Add(strBCC)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olBCC
.Display()
End With

Example 2

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

objOutlook = Globals.ThisAddIn.Application
objOutlookMsg = objOutlook.ActiveInspector.CurrentItem

With objOutlookMsg
objOutlookRecip = .Recipients.Add(strCC)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olCC

objOutlookRecip = .Recipients.Add(strBCC)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olBCC

objOutlookRecip = .Recipients.Add(EmailTo)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olTo
End With
Ads
 




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
Question Inese Vauhkonen Outlook Express 1 March 13th 07 11:49 AM
DST Question Tony Outlook - General Queries 2 March 12th 07 04:05 PM
OE question supertech Outlook - General Queries 1 December 11th 06 07:03 AM
OE & AOL question Doug Kanter Outlook Express 2 April 24th 06 08:39 PM
question manish goyal Outlook and VBA 1 January 21st 06 09:09 AM


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