VBA Site contains VBA code to create macros in WORD EXCEL ACCESS OUTLOOK

 

Moving items between folders

Sub moveitems()

Dim myNameSpace As Outlook.NameSpace

Dim myInbox As Outlook.Folder

Dim myDestFolder As Outlook.Folder

Dim myItems As Outlook.Items

Dim myItem As Object

Set myNameSpace = Application.GetNamespace("MAPI")

Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)

Set myItems = myInbox.Items

 

Set myfolder = myNameSpace.GetDefaultFolder(olFolderInbox).Parent.Folders("Parent_folder")

'Set myfolder = myNameSpace.GetDefaultFolder(olFolderInbox).Folders("Subfolder") 'pick the parent_folder or subfolder

 

Set myItem = myItems.Find("[SenderName] = 'mail@alias.com'")

While TypeName(myItem) <> "Nothing"

myItem.Move myfolder

Set myItem = myItems.FindNext

Wend

End Sub



Dodaj komentarz






Dodaj

© 2013-2024 PRV.pl
Strona została stworzona kreatorem stron w serwisie PRV.pl