Solved

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

Posted on 2010-09-02
5
372 Views
Last Modified: 2012-05-10
How can I make outlook vba check if a new file is added to an outlook folder or not?
0
Comment
Question by:awesomejohn19
[X]
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
5 Comments
 
LVL 59

Expert Comment

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

Chris
0
 

Author Comment

by:awesomejohn19
ID: 33590950
Thanks,

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

Expert Comment

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

Chris
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

0
 
LVL 59

Accepted Solution

by:
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.

Chris
0
 

Author Comment

by:awesomejohn19
ID: 33590965
cool thanks
0

Featured Post

Scamming the Scammers!

Have you ever heard of Scam Baiting?
It's a highly entertaining sport that you can participate in.
Introduction to beating scammers at their own game and how you can help
Share your thoughts, ideas and experiences on the topic.
Links to top Anti-Scam resources provided.

Question has a verified solution.

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

If you don't know how to downgrade, my instructions below should be helpful.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

751 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