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