![]() |
Move an e-mail to Public folder or inbox subfolder
Hello everyone,
just wounder is it possible to write a macro to move an e-mail to a subfolder in public folder ? I would like to have a button on the top of my outlook 2003 so that when I click on that button, it will move a selected e-mail to a subfolder in public folder. I am not a programmer, any help will be really appreciated. thanks |
Move an e-mail to Public folder or inbox subfolder
Are you at least comfortable with working in the VBA Editor? You'll need
some experience there to construct the following: - First select the Public Folder you want to move a message to and run this: Sub GetEntryIDsForCurrentFolder() Debug.Print "EntryID: " & Application.ActiveExplorer.CurrentFolder.EntryID Debug.Print "StoreID: " & Application.ActiveExplorer.CurrentFolder.StoreID End Sub Then use those values for the const# variables in the procedure below: Sub MoveSelectedMessageToConfiguredFolder() On Error GoTo MoveToPublicFolder_Error Dim objPF As Outlook.MAPIFolder Dim constEntryID As String Dim constStoreID As String Dim objMsg As Object If Application.ActiveExplorer.Selection Is Nothing Or Application.ActiveExplorer.Selection.Count 1 Then MsgBox "Please select a single message to move.", vbOKOnly + vbExclamation, "Invalid Selection" Exit Sub End If constEntryID = "{YOUR FOLDER'S ENTRYID}" constStoreID = "{YOUR FOLDER'S STOREID}" Set objPF = Application.Session.GetFolderFromID(constEntryID, constStoreID) If objPF Is Nothing Then MsgBox "Invalid folder.", vbOKOnly + vbExclamation Exit Sub End If Set objMsg = Application.ActiveExplorer.Selection.item(1) objMsg.Move objPF On Error GoTo 0 Exit Sub MoveToPublicFolder_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure MoveSelectedMessageToConfiguredFolder of VBA Document ThisOutlookSession" Resume Next End Sub You can also map this macro to a custom button or run it manually. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Mr555" wrote: Hello everyone, just wounder is it possible to write a macro to move an e-mail to a subfolder in public folder ? I would like to have a button on the top of my outlook 2003 so that when I click on that button, it will move a selected e-mail to a subfolder in public folder. I am not a programmer, any help will be really appreciated. thanks |
All times are GMT +1. The time now is 07:58 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com