why doesnt this code work?

V

voip1234

I am trying to get an automatic bcc using the code provided by
slipstick using the redemption library.

I used the following code

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
Dim objMe As redemption.SafeRecipient
Dim sMail As redemption.SafeMailItem
Set sMail = CreateObject("Redemption.SafeMailItem")
Item.Save
sMail.Item = Item
Set objMe = sMail.Recipients.Add("(e-mail address removed)")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing
Set sMail = Nothing
End Sub

(changing the (e-mail address removed))

and I installed the redemption library (which claimed to have installed
correctly)

this is the error I get (translated from spanish, so its not exact)

compilation error: type not defined by user

then it opens the VB editor and highlights in yellow the line

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

and highlights in blue

Dim objMe As redemption.SafeRecipient

I already rebooted the machine to see if that was required after
installing the redemption library...but I get the same error....

any ideas?

thanks
 
S

Sue Mosher [MVP-Outlook]

Either add Tools | References to add a reference to the Redemption library to your project or declare all the Redemption objects as Object.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
V

voip1234

another question...

there is this other code that goes
------------
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
Dim objMe As Recipient
Set objMe = Item.Recipients.Add("(e-mail address removed)")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing
End Sub
--------------
this works but shows the security warning. then it goes on to say
" You could avoid security prompts by simply setting the Item.Bcc
property to the address."

what exactly would I have to change to try that? I would have to "set
the Item.BCC" from what to what? which line should I change into what?I
am pretty new to this as you can probably tell.
thanks.
 
S

Sue Mosher [MVP-Outlook]

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Item.Bcc = "(e-mail address removed)"
End Sub

See http://www.outlookcode.com/d/propsyntax.htm if you need a primer on Outlook property syntax.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
V

voip1234

thank you twice Sue...I wanted to try the redemption thing, but I
couldnt find any menu option under tools that said references...what I
did do is go to the COM addins and added the redemption library....it
still didnt work.
Then I tried the item.bcc line instead of everything else they
recommended on that page and that did work...i wonder why they dont
include it as another option. Its simple doesnt pop the security prompt
and just works :)
thanks again.

PS.- I tried looking for the tools / references in both outlook xp and
outlook 2003
 
S

Sue Mosher [MVP-Outlook]

You need to be looking at the menus in the VBA environment. That's where you're writing your code, isn't it?

Using Item.Bcc is not the recommended approach, since it removes any previous Bcc recipients from the message.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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