Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / November 2006

Tip: Looking for answers? Try searching our database.

Move send mails from special account

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lau.freddy@web.de - 23 Nov 2006 21:41 GMT
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 "xx@xx.de"   ' folder1
       Item.Move
Outlook.Session.GetDefaultFolders(olFolderInbox).Folders("TEST")
       Case "yy@yy.de"   ' folder2
       Item.Move
Outlook.Session.GetDefaultFolders(olFolderInbox).Folders("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....
Sue Mosher [MVP-Outlook] - 24 Nov 2006 02:15 GMT
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.

Signature

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
 

> Hy together,
>
[quoted text clipped - 29 lines]
>
> Can someone help me please!!! Thanks really for any suggestion....
Spidergate - 24 Nov 2006 08:48 GMT
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
Sue Mosher [MVP-Outlook] - 24 Nov 2006 12:23 GMT
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.

Signature

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
 

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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.