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

Move send mails from special account



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 23rd 06, 09:41 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 1
Default 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  
Old November 24th 06, 02:15 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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  
Old November 24th 06, 08:48 AM posted to microsoft.public.outlook.program_vba
Spidergate
external usenet poster
 
Posts: 1
Default 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  
Old November 24th 06, 12:23 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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
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
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


All times are GMT +1. The time now is 01:30 PM.


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