A Macro Challenge

K

kklimack

Hello Everyone, I am new to the forums so I thought I would start with
a challenging question :) .



I am trying to create a Macro in Outlook to move items based on info in
the subject to folders in Outlook. Basically all I want is if an email
in the Personal Folders> Sent Items or Personal Folders>Storage contain
the following I want them to move to the corresponding folder with a
push of the button. I want this to be a button (or Macro) I run so I
have control over when it is done.



If Subject has "- 21" or "- 22" or "- 23" or "- 24" move to folder
Personal Folder>Customer Emails> 2100-2499

If Subject has "- 25" or "- 26" or "- 27" move to folder Personal
Folder>Customer Emails> 2500-2799

If Subject has "- 28" or "- 29" or "- 30" move to folder Personal
Folder>Customer Emails> 2800-3099

If Subject has "- 31" or "- 32" or "- 33" move to folder Personal
Folder>Customer Emails> 3100-3399

If Subject has "- 34" or "- 35" or "- 36" move to folder Personal
Folder>Customer Emails> 3400-3699



The general idea is to save a lot of time sorting emails. I would
appreciate any help. Thanks!
 
B

Bill James

Example:

sub mySub()
Dim theItem as MailItem

For Each theItem In Outlook.Session.GetDefaultFolder
(olFolderInbox).Items
If (TypeName(theMailItem) = "MailItem") Then
Select Case Left(theItem.Subject,4)
Case "- 21", "- 22", "- 23", "- 24"
theItem.Move Outlook.Session.Folders
("Customer Emails").Folders("2100-2499")
Case "- 25", "- 26", "-27"
theItem.Move Outlook.Session.Folders
("Customer Emails").Folders("2500-2799")
' ... you fill in the rest ...
Case Else
MsgBox "Proper Subject Not Found"
End Select
End If
Next
end sub

This code assumes several things:

The emails you want to move are in your Inbox.

That you have a personal folder "Customer Emails" with
sub folders called "2100-2499", "2500-2799", etc.

And that the subject starts with "- xx". If the subject
does not start with "- xx" then you have to parse the
subject string to extract that portion that will give you
enough information as to where to put the email.

Maybe you might post some examples of your subject
strings.
 
K

kklimack

I handle a lot of customer support so a good example would be:



Please help - 2345



I would be looking to take most of the emails from the sent items box so
I would have their question and my response, so I guess the actual
subject would be ex. Re: Please help - 2345



The only other folder I would want to take from would be the 'Customer
Emails' but not it's subfolders.



Thanks or your help.
 
I

Iolaire McFadden

Couldn't you just use 5 rules (Tools - > Rules Wizard)?
If subject line = ?? or subject line = ??? move it to
folder ???
iolaire
 
K

kklimack

The rules would only allow me to send a copy which would double the size
of my already huge .pst file. If I am mistaken and you know a way to do
this please let me know.



Thanks
 

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