# Office 365 >  > [SOLVED] Selectin emails in Outlook

## Szwadron6

Hi,

I'd like to ask you for help since I need to use the vba code in order to select (and do nothing else) all emails that are located in my Inbox in Outook and were received today. - it will be for generated reports each day that's why it is crucial to select only emails on that specific day.

Do you have any solution?

Thank you in advance.

----------


## NickyC

Hi
this seems to work though it may be a bit slow if your inbox contains lots of emails




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

----------


## Szwadron6

Hi,

thank you for the answer. Unfourtunatley it does not work for me in any way. Nothing happens in my mailbox.

Could you indicate what to do to fix this?

----------


## NickyC

Hi
the macro assumes that the emails to select are in your default inbox and this is the active view in Outlook. If this isn't the case the macro may not work

----------


## Szwadron6

I must have done something wrong in the first place. It does work now. Thank you for your help

----------


## NickyC

you're welcome. I'm glad it worked.

----------


## Szwadron6

Hi!

I just wanted to change the code a little bit and instead of today's date I want to choose yesterday's. So I thought to create DAte - 1 but not working




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


Could you please let me know as well how to change it accordingly?

Also when I have selected for example a may from a week while macro is running it does select emails from today but also the one that was selected before macro is activated. Is there a way to unselct that email then?

Many thanks in advance.

----------


## NickyC

Hi 
the received time property is a number comprising both date and time, so changing the formula from "greater than" to "equals" will only capture emails sent at precisely midnight. Try this instead:




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

----------

