#  Other Applications & Softwares  > Outlook Formatting & Functions >  >  button to copy and move emails

## stevesunfold

hi guys 
i get over 200 emails a day at work and i need to sort them as fast as i can which at the minute takes ages
i would like a button or maybe even a right click option where i can select copy to or move to
then type in the folder it needs to go to.
i have over 6000 fodlers that it could go in so i need to make this as simple as possible
regards

----------


## stevesunfold

ideally a button would provide a pop up asking me where email should go
i can then type in the folders name
ie J5800 and off it goes
i do also have some for suppliers and staff names
lots of the emails i get dont have references in so that i can set up the other way so if i could do this it would be great

----------


## DonkeyOte

Steve, to be honest I'm not quite sure how this would work.... as I see you essentially have 1 of 2 approaches available to you

1 - enter the name in a dialog box 
-- this would then require the VBA iterate your mailbox whilst trying to find the chosen folder in which to move the selected items into (presumably you would want to move 1+ at a time ?)

2 - pick the folder itself using some sort of "select folder" dialog
-- but this would merely mimic what you would do were you doing it manually... my guess is it takes you too long to "find" the folder, correct ?

Given the volume of folders you're talking about option 1 "may" be slow to run

_(I'm not an Outlook wiz so someone who is may have other ideas)_

Is there any logic to determine folder selection based on mail subject, content etc... ?  
(ie can you not use standard Rules for some of the items to be moved on delivery thereby limiting the amount you must move by *other* (ie VBA) means)

----------


## stevesunfold

hi donkeyote
im just after a faster more effective way of copying/moving to the requested folder.
Im not sure how i can go about it either but at the moment i have to right click select move and then select the folder which is very time consuming.

----------


## stevesunfold

of your options im guessing option 1 is the right choice for me

----------


## broro183

hi Steve,
I'm not an Outlook wizz either but you should be able to order your Inbox by  using an identifying field (eg From or Subject etc), select all the relevant emails, then "drag & drop" them into the relevant folder (set your screen up to show the Folders in a tree structure on the left of your screen).

If you have some solid logic for the sorting process you can set up Outlook rules which automatically file the emails based on criteria under Outlook - Tools - Rules & Alerts... . I think there are some limitation to the number of rules but that can be checked by a quick Google.
edit: Ooopps! I didn't see that Donkeyote had already mentioned the std Rules approach.


hth
Rob

----------


## stevesunfold

hi broro
thanks for the reply
i already use rules where possible but most of my emails that come in cannot be used in that particualr way

----------


## DonkeyOte

Hi Steve, I agree with Rob who reiterates my point re: rules... ie you've not specified if there is any underlying logic to the movement of the mail items themselves in whole or part.

----------


## DonkeyOte

EDIT: simultaneous posts' :-) ... 

Steve, I will post something up VBA wise -- doing a few other bits and pieces presently

----------


## stevesunfold

thanks donkeyote
dont go out of your way for me though im more than happy to wait
regards

----------


## DonkeyOte

Steve, I've cobbled something together here... this should all reside in a stand alone module (Insert - Module)

My code:




```
Please Login or Register  to view this content.
```


The above utilises the below function which I picked up online -- this can be placed either in the same module as the above or in a separate module, whichever you prefer... this function does the hard work (which I was wasting time replicating) namely locating the folder based on just it's short hand name (given it could reside anywhere in the mailbox at any level in the hierarchy) -- so credit where credit to Jeff Rockow.




```
Please Login or Register  to view this content.
```


If you wish to run the MOVE_MAIL routine from a button directly on your toolbar then do the following:




```
Please Login or Register  to view this content.
```

----------


## stevesunfold

hi donkey
thanks for your efforts
even though i have changed nothing
im trying the top one
im getting a message 
the macros in this project are disabled
and i havent done anything  to it~???

----------


## DonkeyOte

OK just to clarify you need both pieces of code for this to work-- mine uses the 2nd piece in the following line:




```
Please Login or Register  to view this content.
```


The bit in red utilises the 2nd bit of code.

*Re: Macros disabled warning*... ensure you have both bits of code stored then save the VBA project in the VB Editor (where the code is) using the Save Icon at the top ... then Quit Outlook -- re-open ... if prompted opt to Enable Macros.

Check to see if it works.

_(Given your other posts in this forum I'm assuming that you can't have High security in place as you have successfully implemented other solutions)
_

----------


## stevesunfold

how do i enable them donkey i cant seem to

----------


## DonkeyOte

When you re-opened OL were the Macros disabled ?

If so go to Tools -> Macro -> Security

I would select Medium for pre 2007 versions or for 2007 select "Warnings for All Macros".

Close OL -- reopen -- hit ALT + F11 -- when prompted choose Enable.

----------


## stevesunfold

OH MY GOD
donkeyote that is absolutely amazing
thats going to save so much time its unreal
is there anyway i can have a copy button to as i sometimes have to copy emails to several folders
thanks so much

----------


## DonkeyOte

I've tweaked my code to below:




```
Please Login or Register  to view this content.
```


This is not thoroughly tested but in essence you will now get 2 prompts...

Prompt 1 -- as before -- enter Folder Name
Prompt 2 -- new -- action -- Move (enter M) or Copy (enter C)

The code should do the rest based on the results of those prompts.

Note: the other code (the function I gleaned from the internet) remains unaltered.

----------


## stevesunfold

absolutely amazing

the only thing i dont like personally is the fact that if you make a mistake of any kind you cant get out of it until you click no retry

did you get my pm?

----------


## DonkeyOte

Not sure I follow -- what do you mean by making a mistake and not being able to exit ?

As I see it you can only make a mistake one of two ways:

1 -- enter an incorrect action (ie failing to enter M or C in 2nd Input Box)
2 -- enter an invalid folder name

The former error loops you back to re-enter the action whereas the latter asks if you wish to terminate altogether via No response to Re-Try prompt.

Do you mean you would like an exit point prior to the routine commencing -- ie click button -- "Are you sure you want to do this...?" 

As for the PM -- yes received... not had time to respond as yet but no recompense necessary... I'm a layabout presently with lots of time to kill... :-)

----------


## stevesunfold

Donkey
its ok dont worry im being far too picky
thank you so so much 
i can live with the outcome

very many king regards

----------


## stevesunfold

i have just noticed a little flaw that is a tad annoying
its case sensitive
surely thats easy to change?

----------


## DonkeyOte

you will need to adjust the 2nd bit of code (ie the Function I collected from the internet), change the following line:




```
Please Login or Register  to view this content.
```


to




```
Please Login or Register  to view this content.
```


by coercing both to UCASE the test becomes case insensitive... though obviously in doing so you lose the ability to differentiate between Folder x and Folder X and other variations... if you want to toggle case sensitivity you could do, let me know and I will post back later.

----------


## stevesunfold

im not entirely sure what you mean by toggle
i will give it a go
right now
thanks

just tried it and thats perfect

youre a star

----------


## DonkeyOte

by toggle I meant that you could in theory pass a further optional argument to the Function that dictated as to whether or not the search should be case sensitive or not... would require a little tweak to both my code and the existing Function.

----------


## stevesunfold

more than happy
this will save me no end of time
so many thanks to you for all your effort 
kind regards
steve

----------


## suryaprasad

Steve,

I think all these codes are time consuming ---

here is an idea for you think smart to do this---

After receving all the mails in you Inbox you can have a standered wording either in subject or the body line.Then you need to go to right end corner where you can see a button as Options then click on it then go to advanced find and then go to 2nd Option - Subject field and message body where you type the standered word and date you have sent to them then it will collect all the mails with the word and date which you sent to them then after receving all the emails then you right click and then to the folder you want it ....> hope this helps you very fast instead of doing all these steady work

----------


## DonkeyOte

Surya,

2 questions

1) have you actually read the post in full

2) have you actually tested the code ?

I suspect the answer is no on both counts.

----------

