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 / September 2005

Tip: Looking for answers? Try searching our database.

Marco to move files and mark as read

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Neil1958 - 20 Sep 2005 02:23 GMT
1) I can move items to a different folder under Inbox directory but how can I
move them to a directory on the same level as the Inbox.
2) How do I mark thess files as read at the same time as I move them.

Below works for the move but not for a directory on the same level as the
Inbox called "Completed".
Sub NeilMove()
   Dim myolApp As New Outlook.Application
   Dim myNamespace As Outlook.NameSpace
   Dim myInbox As Outlook.MAPIFolder
   Dim myDestFolder As Outlook.MAPIFolder
   Dim myItems As Outlook.Items
   Dim myItem As Object
   Set myNamespace = myolApp.GetNamespace("MAPI")
   Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox)
   'Set myInbox = myNamespace.GetDefaultFolder(olFolderCompleted)    
   Set myItems = myInbox.Items
   Set myDestFolder = myInbox.Folders("Saved Mail")
   Set myItem = myItems.Find("[SenderName] > 'a'")
   While TypeName(myItem) <> "Nothing"
       myItem.Move myDestFolder
       Set myItem = myItems.FindNext
   Wend
End Sub

Michael Bauer - 20 Sep 2005 06:46 GMT
Am Mon, 19 Sep 2005 18:23:01 -0700 schrieb Neil1958:

1) The NameSpace has also a folders collection. Use that instead of the
Inbox´ folders collection.

2) The MailItem has a Unread property. Set it to False and save the
MailItem.

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> 1) I can move items to a different folder under Inbox directory but how can I
> move them to a directory on the same level as the Inbox.
[quoted text clipped - 20 lines]
>     Wend
> End Sub
 
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.