Outlook VBA to check if a new file is added to an outlook folder since last check?

Posted on 2010-09-02
Last Modified: 2012-05-10
How can I make outlook vba check if a new file is added to an outlook folder or not?
Question by:awesomejohn19
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 59

Expert Comment

by:Chris Bottomley
ID: 33590924
Thinking slightly differently - how about detecting the addition of an item to a folder directly?


Author Comment

ID: 33590950

I guess that's ok too. How would we achieve that? :)
LVL 59

Expert Comment

by:Chris Bottomley
ID: 33590951
The following in thisOutlookSession for example will trigger whenever something is added to the inbox.

Public WithEvents olkInbox As Outlook.items

Private Sub Application_Startup()

    Set olkInbox = Session.GetDefaultFolder(olFolderCalendar).items

End Sub

Sub olkInbox_ItemAdd(ByVal Item As Object)
    msgbox "Item Added:> " & item.subject
End Sub

Open in new window

LVL 59

Accepted Solution

Chris Bottomley earned 500 total points
ID: 33590961
The startup sub needs to be triggered to enable it to work ... and is run whenever outlook restarts - or you can simply run it the first time, and from then on it;'s triggered whenver an item is added.  Of course pretty much any folder can be processed in this way.


Author Comment

ID: 33590965
cool thanks

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question