Move email from specific folder (under the inbox) to a specific fo

E

Emil

Hi,
I need a bit of help please.

I am looking for a macro that allows me to move emails from a specific
folder (under a Microsoft exchange inbox) to a specific folder (on a pst
file).

The macro has to be easy to be modified as my needs change on a monthly bases.

The reason of my request is that the company i work for gave me a blackberry
linked to my work exchange account. Presently, i have to pass 2 times through
my emails (once when I receive them on my BB, second time, on my PC to file
them). I replicated the PST entire folder structure in my inbox to be able to
file the emails from my BB once they are read.

The problem I am facing is that I have to do about 20 to 25 copy pastes per
each 2-3 days in order to keep my exchange mailbox under the storage limit.

IIf anybody could give me a hand to automatize this time wasting situation,
I would much appreciate it.

Regards, Emil
 
J

JP

Why not use the AutoArchive feature and have Outlook create a PST file
on your local drive? Or ask IT to increase your limit?

If you want a VBA solution, you need to set an object reference to the
message you want to move, and the folder you want to move it to. For
example, this code will move a selected or open mail item to a folder
called "Archive", one level below the Inbox (if you don't have that
folder, you would need to create it). Adjust reference as necessary.

Sub MoveEmail()
Dim myItem As Outlook.MailItem
Dim MyFolder As Outlook.MAPIFolder
Dim olNS as Namespace

' get valid ref to current item
On Error Resume Next
Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set myItem = ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set myItem = ActiveInspector.CurrentItem
Case Else
End Select
On Error GoTo 0

If myItem Is Nothing Then
MsgBox "Could not use current item. Please select or open a
single email.", vbInformation
Exit Sub
End If

Set olNS = Application.GetNamespace("MAPI")
Set MyFolder = olNS.GetDefaultFolder(olFolderInbox).Folders("Archive")

myitem.Move MyFolder

End Sub

You will have to point MyFolder to the correct folder. See
http://www.codeforexcelandoutlook.com/ResendMsg.html if you want to
assign this code to a toolbar button for easy access.

HTH,
JP
 
E

Emil

Hi JO,

Thanks for your quick answer.

The Auto-Archive function is good, but it does not entirely answer my need
(it only lets me choose the PST file for the auto archive and it will
replicate the inbox folder tree). I need to be able to choose the source
folder (from the inbox) and the destination folder (which usualy is an
already created folder with a totally different name and path in my PST)

Thanks for the macro. It is good, all tough I will need a slight change in
it. I do not need to move items that I select from INBOX. I need to move the
contents of each one of my 20 folders from under my INBOX to some specific
paths in my PST (ex: The contents of the folder MAILBOX/INBOX/Email
concerning John will go in PST PersonalFolders/Employees/John Malcom/Emails
concerning John)

I need it in this way as I file my emails (in my Inbox Folders)when I
receive them in on my BlackBerry (which can only access the Exchange Server)
and I want to avoid 20 copy/pastes from the inbox folders to their
corespondents in my PST.

Also, as I work in a customer service enviroment and I change employees
often, I would need to be able to change the source and the target folders
easily in the macro (I am all new to this type of usage).

I would prefer a simple macro (that does only this funtion for one email
transfer) and I will multiply it myself for the number of the folders I need.

I can more easily work with it as when an employees leaves I only have to
remove his specific macro without touching to the others.

I really appreciate your help.

I hope that what I need is not too complicated to program :)

Thanks in advance
 
R

rcd

A more specific question is how to I move ALL emails from the INBOX to
another folder or PST? I set up a rule, the move all emails addressed to me,
to antoehr pst. That sounds correct, expect when implemented, it will not
move emails sent to me if I'm part of a group.

this is goofy. Where is the move *.* commmand?

rcd
 
J

JP

If you want to move every email that comes into your Inbox, then it
doesn't matter who it is sent to, the fact that it is in your Inbox
means it was sent to you. That is what VBA will do for you.

If you want to move all incoming emails to another folder, this code
should work as a starting point.

http://tinyurl.com/6gun7q


HTH,
JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top