Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / May 2005

Tip: Looking for answers? Try searching our database.

How to add a bcc recipient to the current email item

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marceepoo - 08 May 2005 19:14 GMT
1.  I can't figure out how to add a bcc recipient to an email I've already
created.  I've been using the macro below (which works) to create a new
email, but I'd like to use a macro to add a bcc to an existing email, so that
I don't have to wait for the mailbox window.
2.  In the macro below (cannibalized from ), the email address is used for
the recipient, instead of the Outlook name of the recipient.  How could I
change the macro to instruct Outlook to use the name (of the recipient) in an
address book?

Thanks for any ideas.    Here's my macro....

Sub Add_NM()
 Dim myOlApp As Outlook.Application
 Dim myItem As Outlook.MailItem
 Dim myRecipient As Outlook.Recipient
 '
 Set myOlApp = CreateObject("Outlook.Application")
 Set myItem = myOlApp.CreateItem(olMailItem)
 Set myRecipient = myItem.Recipients.Add("Harvey@Hithere.com")
 '
 myRecipient.Type = olBCC
 myItem.Display
End Sub
Michael Bauer - 09 May 2005 08:58 GMT
Just resolve the Recipient after adding. If the name is in your
addresses then it will be displayed.

Signature

Viele Grüße / Best regards
Michael Bauer - MVP Outlook

> 1.  I can't figure out how to add a bcc recipient to an email I've already
> created.  I've been using the macro below (which works) to create a new
[quoted text clipped - 19 lines]
>   myItem.Display
> End Sub
Marceepoo - 09 May 2005 14:44 GMT
I apologize, but I don't understand.  Could you explain more explicitly?  
Sorry for my ignorance.
                                  Marc

> Just resolve the Recipient after adding. If the name is in your
> addresses then it will be displayed.
[quoted text clipped - 28 lines]
> >   myItem.Display
> > End Sub
Michael Bauer - 09 May 2005 19:01 GMT
You can call myItem.Recipients.ResolveAll after adding the Recipient(s).

Signature

Viele Grüße / Best regards
Michael Bauer - MVP Outlook

> I apologize, but I don't understand.  Could you explain more explicitly?
> Sorry for my ignorance.
[quoted text clipped - 32 lines]
> > >   myItem.Display
> > > End Sub
Marceepoo - 11 May 2005 05:22 GMT
Dear Micheal:

   First, thanks for continuing to try to help me.  I probably should have
notified you that I'm a newbie, rather than an experienced programmer.  
   I don't understand what code you are trying to tell me to insert, nor
where I should insert it.  Also, I think you're only addressing the second of
my two questions.  

> You can call myItem.Recipients.ResolveAll after adding the Recipient(s).
>
[quoted text clipped - 38 lines]
> > > >   myItem.Display
> > > > End Sub
Michael Bauer - 11 May 2005 07:36 GMT
Hi Marc,

1) the code you´re showing is creating a BCC already. For accessing an
existing e-mail there are serveral methods. You can use
Application.ActiveInspector for a currently opened e-mail,
Application.ActiveExplorer.Selection(1) for the first selected item in
the currently viewed folder (if any), or the Items´ Find method for
searching an item in a folder.

You will find help and samples easily via the Object Browser:

Please press F2 from within the VBA environment, switch then from <All
Libraries> to Outlook. In the left pane you´ll see all classes, in the
right one their methods, properties, etc.

You can select the above mentioned methods and classes and press F1 for
more help and sample code.

2) I gave you the code. Please insert it before calling myItem.Display.

Signature

Viele Grüße / Best regards
Michael Bauer - MVP Outlook

> Dear Micheal:
>
[quoted text clipped - 46 lines]
> > > > >   myItem.Display
> > > > > End Sub
Marceepoo - 12 May 2005 06:48 GMT
Dear Michael:
   I have spent several hours trying to do what you instructed me to do, so
please forgive me for not understanding yet.  The goal is to be able to have
the macro add a "Bcc" to an email that I've already created/opened, but that
I haven't sent yet.
   I modified my code as indicated below.  The email address xxx is
inserted in the "To" field, instead of the "Bcc" field, and I can't figure
out [a] how to get the email address to appear in the "Bcc" field, nor [b]
where to find an explanation for what I'm doing wrong, and what the
correction is.  For some reason, the macro seems to be ignoring the line:  
objOutlookRecip.Type = olBCC
   Sorry to be such a pain.    thanks again for your help,

                         Marceepoo
Here's the new code:

Sub Add_bcc()
   Dim myOlApp As Outlook.Application
   Dim myItem As Outlook.MailItem
   Dim myRecipient As Outlook.Recipient
   Dim objOutlookRecip As Outlook.Recipient
   '
   Set myOlApp = CreateObject("Outlook.Application")
   'Set myItem = myOlApp.CreateItem(olMailItem)
   Set myItem = myOlApp.ActiveInspector.CurrentItem
   With myItem
       Set objOutlookRecip = .Recipients.Add("Harvey@Hithere.com")
       objOutlookRecip.Type = olBCC
   End With
   '
   objOutlookRecip.Type = olBCC
   Application.ActiveInspector
   myItem.Display
End Sub

> Hi Marc,
>
[quoted text clipped - 77 lines]
> > > > > >   myItem.Display
> > > > > > End Sub
Michael Bauer - 12 May 2005 07:56 GMT
Marc, in fact you´re almost right. If the item is opened already then
setting the Type=olBCC adds the same Recipient twice (tested in OL2k).
This seems to work only if the item is closed.

Instead of using Recipients.Add you can use the BCC property.

Ie in you code:
myItem.BCC="Harvey@Hithere.com"
myItem.Recipients.ResolveAll

Please note: If you´re accessing the already opened item
(ActiveInspector.CurrentItem) then it isn´t necessary to call
myItem.Display again.

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Dear Michael:
>     I have spent several hours trying to do what you instructed me to do, so
[quoted text clipped - 112 lines]
> > > > > > >   myItem.Display
> > > > > > > End Sub
Marceepoo - 12 May 2005 16:32 GMT
  Much thanks + Congratulations for being able to explain it so that even I
could understand.  
   Now, to punish you for your act of kindness... Where could I find a book
or tutorial, or website, to learn this type of stuff?  I've managed to learn
enough Word vba to be able to do most of what I want to do in Word vba [I
have very limited aspirations]; but I'm rather lost in Outlook vba.  I just
finished reading Jim Boyce's Outlook 2003 Inside Out, but the treatment of
macros (even in the appendices) isn't really thorough/basic enough for a
newbie like me.  I bought Sue Mosher's book, and I'm going to go through it,
but it looks like it's for people who know more than I do.  
  Thanks again.  Your help (and willingness to stay with me) was much
appreciated.

                             marceepoo

> Marc, in fact you´re almost right. If the item is opened already then
> setting the Type=olBCC adds the same Recipient twice (tested in OL2k).
[quoted text clipped - 150 lines]
> > > > > > > >   myItem.Display
> > > > > > > > End Sub
Sue Mosher [MVP-Outlook] - 12 May 2005 16:56 GMT
PMJI, but I wrote my book with novices in mind. If you start at the beginning rather than the end, I think it will answer most of your questions.

Signature

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

>   Much thanks + Congratulations for being able to explain it so that even I
> could understand.  
[quoted text clipped - 8 lines]
>   Thanks again.  Your help (and willingness to stay with me) was much
> appreciated.
Marceepoo - 12 May 2005 17:30 GMT
Thanks, Sue.  The book seems really well written, from the little I've read.  
And you're right.  I should read it before I talk about it.  Thanks for the
help.
           Marc

> PMJI, but I wrote my book with novices in mind. If you start at the beginning rather than the end, I think it will answer most of your questions.
>
[quoted text clipped - 10 lines]
> >   Thanks again.  Your help (and willingness to stay with me) was much
> > appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.