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 an e-mail to Public folder or inbox subfolder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 22nd 07, 08:25 PM posted to microsoft.public.outlook.program_vba
Mr555
external usenet poster
 
Posts: 2
Default 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


  #2  
Old February 23rd 07, 03:39 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default 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


 




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
Outlook move to public folder [email protected] Outlook and VBA 10 December 15th 06 02:39 PM
Help problems setting up rule to move email to a public folder Dab Outlook - General Queries 0 October 18th 06 01:09 AM
After I've moved a note from Inbox to folder A, I can't move it to Folder B. [email protected] Outlook - General Queries 0 August 9th 06 10:46 PM
How i export/copy/move messages in a public folder outlook 2003? Olatunde R. Adeniran Outlook - Using Contacts 1 May 3rd 06 06:51 PM
auto linking of Inbox subfolder with server folder [email protected] Outlook and VBA 1 February 6th 06 09:09 PM


All times are GMT +1. The time now is 10:44 AM.


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