A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Moving sent items instead of copying them to "Sent items" folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 1st 06, 12:09 PM posted to microsoft.public.outlook.program_vba
Catalin
external usenet poster
 
Posts: 15
Default Moving sent items instead of copying them to "Sent items" folder

Dear Friends,

Please help me with this problem:
I use OL 2003 and I need to move the sent items based on the acoount through
which they are being sent. I have to mention that I have 3 accounts as well.
I have a code which is presented below but it doesn't seem to work.

Option Explicit

Public WithEvents SentItemsAdd As Items

Private Sub Application_MAPILogonComplete()
Set SentItemsAdd =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderSentMail).Items
End Sub

Private Sub SentItemsAdd_ItemAdd(ByVal Item As Object)
If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("wor k2006").Folders.Item("Sent
Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("sal esl2006").Folders.Item("Sent Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

'and so on

End Sub

The event is not triggered.

Can somebody help?

Thanks in advance,
Catalin
Ads
  #2  
Old November 1st 06, 02:55 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Moving sent items instead of copying them to "Sent items" folder

This code is in the Outlook VBA project, in the ThisOutlookSession class
module? If so move the initialization code to Application_Startup and see
what happens. Are macros enabled or disabled for your setup?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Catalin" wrote in message
...
Dear Friends,

Please help me with this problem:
I use OL 2003 and I need to move the sent items based on the acoount
through
which they are being sent. I have to mention that I have 3 accounts as
well.
I have a code which is presented below but it doesn't seem to work.

Option Explicit

Public WithEvents SentItemsAdd As Items

Private Sub Application_MAPILogonComplete()
Set SentItemsAdd =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderSentMail).Items
End Sub

Private Sub SentItemsAdd_ItemAdd(ByVal Item As Object)
If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("wor k2006").Folders.Item("Sent
Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("sal esl2006").Folders.Item("Sent
Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

'and so on

End Sub

The event is not triggered.

Can somebody help?

Thanks in advance,
Catalin


  #3  
Old November 1st 06, 04:40 PM posted to microsoft.public.outlook.program_vba
Catalin
external usenet poster
 
Posts: 15
Default Moving sent items instead of copying them to "Sent items" fold

Yes the code is in the ThisOutlookSession class module. The macros are
enabled as well.

I will try your suggestion and come back to you.

Thanks for your answer.
Catalin


"Ken Slovak - [MVP - Outlook]" wrote:

This code is in the Outlook VBA project, in the ThisOutlookSession class
module? If so move the initialization code to Application_Startup and see
what happens. Are macros enabled or disabled for your setup?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Catalin" wrote in message
...
Dear Friends,

Please help me with this problem:
I use OL 2003 and I need to move the sent items based on the acoount
through
which they are being sent. I have to mention that I have 3 accounts as
well.
I have a code which is presented below but it doesn't seem to work.

Option Explicit

Public WithEvents SentItemsAdd As Items

Private Sub Application_MAPILogonComplete()
Set SentItemsAdd =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderSentMail).Items
End Sub

Private Sub SentItemsAdd_ItemAdd(ByVal Item As Object)
If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("wor k2006").Folders.Item("Sent
Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("sal esl2006").Folders.Item("Sent
Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

'and so on

End Sub

The event is not triggered.

Can somebody help?

Thanks in advance,
Catalin



  #4  
Old November 3rd 06, 12:47 PM posted to microsoft.public.outlook.program_vba
Oliv'
external usenet poster
 
Posts: 6
Default Moving sent items instead of copying them to "Sent items" fold


*Catalin que je salut a écrit *:

try with this example :


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim prompt As String
Dim objCurrentMessage As MailItem
Dim objNS As NameSpace
Dim objFolder As MAPIFolder

On Error GoTo fin
Set objCurrentMessage = Item

If objCurrentMessage.DeleteAfterSubmit = False Then
Title = "Voulez-vous garder une copie de ce mail ?"
prompt = Item.Subject + vbCr + vbCr + "[OUI] vous choisissez le
répertoire, [NON] envoi sans garder de copie" + vbCr + vbCr + "[ANNULER]
dans 'Sélectionner un dossier' envoi en gardant copie dans 'éléments
supprimés'"
copie = MsgBox(prompt, vbYesNoCancel + vbQuestion + vbDefaultButton2,
Title)
If copie = 2 Then
Cancel = True
GoTo fin
End If
If copie = vbNo Then
objCurrentMessage.DeleteAfterSubmit = True
Else

Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If TypeName(objFolder) = "Nothing" Then
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderDeletedItems)
End If
Set Item.SaveSentMessageFolder = objFolder

Set objFolder = Nothing
Set objNS = Nothing
End If
End If
fin:
End Sub


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have a nice day
Oliv'
Outlook : http://faq.outlook.free.fr/
les archives : http://groups.google.com/group/micro...lic.fr.outlook
Dernière chance http://www.outlookcode.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sent Items"Unable to display the folder" [email protected] Outlook - General Queries 5 October 4th 06 03:19 PM
Problem re "Deleted Items" Folder CWLee Outlook Express 4 September 24th 06 08:21 AM
Moving mail items into an "Archive" folder Corey Thompson Outlook and VBA 4 June 17th 06 10:58 AM
How do I transfer items from my contacts folder to the "to:" list Riteesh Outlook - Using Contacts 3 May 9th 06 11:35 AM
Deleting calendar items should ask "all past and future items" katie Outlook - Calandaring 0 April 4th 06 04:52 AM


All times are GMT +1. The time now is 08:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.