How to add a bcc recipient to the current email item

M

Marceepoo

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("(e-mail address removed)")
'
myRecipient.Type = olBCC
myItem.Display
End Sub
 
M

Michael Bauer

Just resolve the Recipient after adding. If the name is in your
addresses then it will be displayed.
 
M

Marceepoo

I apologize, but I don't understand. Could you explain more explicitly?
Sorry for my ignorance.
Marc
 
M

Marceepoo

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

Michael Bauer

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

Marceepoo

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
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("(e-mail address removed)")
objOutlookRecip.Type = olBCC
End With
'
objOutlookRecip.Type = olBCC
Application.ActiveInspector
myItem.Display
End Sub
 
M

Michael Bauer

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="(e-mail address removed)"
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.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook


Marceepoo said:
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
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("(e-mail address removed)")
objOutlookRecip.Type = olBCC
End With
'
objOutlookRecip.Type = olBCC
Application.ActiveInspector
myItem.Display
End Sub




Michael Bauer said:
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.

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


should
have insert,
nor the
second of email
I've address
is recipient.
How
 
M

Marceepoo

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

Michael Bauer said:
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="(e-mail address removed)"
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.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook


Marceepoo said:
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
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("(e-mail address removed)")
objOutlookRecip.Type = olBCC
End With
'
objOutlookRecip.Type = olBCC
Application.ActiveInspector
myItem.Display
End Sub




Michael Bauer said:
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.

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


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

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

:

Just resolve the Recipient after adding. If the name is in your
addresses then it will be displayed.

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


message
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("(e-mail address removed)")
'
myRecipient.Type = olBCC
myItem.Display
End Sub

 
S

Sue Mosher [MVP-Outlook]

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

Marceepoo

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

Sue Mosher said:
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.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Marceepoo said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top