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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Move send mails from special account
Hy together,
im getting really mad with VBA in Outlook 2003. Im trying to check when a mail has been send from which account it was send. After that I want to move the sent mail in a special folder if the sender is .... Im trying it with this code.... Option Explicit Public WithEvents SentItems As Outlook.Items Private Sub Application_Startup() Set SentItems = _ Outlook.Session.GetDefaultFolder(olFolderSentMail) .Items End Sub Private Sub Application_Quit() Set SentItems = Nothing End Sub Private Sub SentItems_ItemAdd(ByVal Item As Object) Select Case Item.From Case " ' folder1 Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox).F olders("TEST") Case " ' folder2 Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox).F olders("TEST2") Case Else ' Leave it in the top Inbox Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox) End Select End Sub Can someone help me please!!! Thanks really for any suggestion.... |
Ads |
#2
|
|||
|
|||
Move send mails from special account
The object browser -- F2 in VBA -- is your friend. If you looked at the properties for MailItem, you'd see there is no From property but there is a SenderEmailAddress.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx wrote in message ups.com... Hy together, im getting really mad with VBA in Outlook 2003. Im trying to check when a mail has been send from which account it was send. After that I want to move the sent mail in a special folder if the sender is .... Im trying it with this code.... Option Explicit Public WithEvents SentItems As Outlook.Items Private Sub Application_Startup() Set SentItems = _ Outlook.Session.GetDefaultFolder(olFolderSentMail) .Items End Sub Private Sub Application_Quit() Set SentItems = Nothing End Sub Private Sub SentItems_ItemAdd(ByVal Item As Object) Select Case Item.From Case " ' folder1 Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox).F olders("TEST") Case " ' folder2 Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox).F olders("TEST2") Case Else ' Leave it in the top Inbox Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox) End Select End Sub Can someone help me please!!! Thanks really for any suggestion.... |
#3
|
|||
|
|||
Move send mails from special account
Hy,
thanks for your quick answer.... :-)) It seems that I really need to learn how VBA Scripting is working... I canīt get that thing to work.... Can you do me a favour an give me the complete string of the script.... Thanks an best regards |
#4
|
|||
|
|||
Move send mails from special account
All you should need to do is change Item.From to Item.SenderEmailAddress. IF that doesn't work, make sure you've taken care of the basics listed at http://www.outlookcode.com/d/vbabasics.htm, put in a breakpoint, and step through the code.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Spidergate" wrote in message ups.com... Hy, thanks for your quick answer.... :-)) It seems that I really need to learn how VBA Scripting is working... I canīt get that thing to work.... Can you do me a favour an give me the complete string of the script.... Thanks an best regards |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to move send mails to secondary mailbox | Gvaram | Outlook and VBA | 4 | October 3rd 06 05:45 AM |
move account to another computer | Leslie | Outlook - Using Contacts | 4 | February 28th 06 04:39 PM |
Outlook 2003 changes the outgoing account when unable to send by selected account | HeidarV | Outlook - General Queries | 1 | January 16th 06 02:26 PM |
Outlook 2003 changes the outgoing account when unable to send by selected account | HeidarV | Outlook - General Queries | 0 | January 14th 06 08:44 AM |