Link to home
Start Free TrialLog in
Avatar of A G
A GFlag for United States of America

asked on

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

How can I make outlook vba check if a new file is added to an outlook folder or not?
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Thinking slightly differently - how about detecting the addition of an item to a folder directly?

Chris
Avatar of A G

ASKER

Thanks,

I guess that's ok too. How would we achieve that? :)
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

ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of A G

ASKER

cool thanks