Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 06-15-2016, 08:15 PM
gmayor's Avatar
gmayor gmayor is offline Help to create a rule Windows 10 Help to create a rule Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The red text suggests that you don't have the appropriate sounds dll installed, so delete the previous macros and use the following simpler version instead. The yellow line may reflect the above error, or it could indicate that the Maria folder is not a sub folder of the default inbox. If that is the case I would need to know your Outlook folder structure in order to suggest changes.

Code:
Option Explicit
Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim olApp As Outlook.Application
    Set olApp = Outlook.Application
    Set Items = GetNS(olApp).GetDefaultFolder(olFolderInbox).folders("Maria Alencar").Items
End Sub

Private Sub Items_ItemAdd(ByVal item As Object)
    On Error GoTo ErrorHandler
    Beep
    MsgBox "There's a new item in Maria's folder."
ProgramExit:
    Exit Sub
ErrorHandler:
    Beep
    MsgBox Err.Number & " - " & Err.Description
    Resume ProgramExit
End Sub

Private Function GetNS(ByRef app As Outlook.Application) As Outlook.NameSpace
    Set GetNS = app.GetNamespace("MAPI")
End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rule to forward email using rule to me@onenote.com anony1 OneNote 2 02-04-2023 02:39 PM
create rule to copy sent items to specified folder shmu Outlook 0 12-15-2015 04:08 AM
Help to create a rule Mail merge from excel - need to create sheets and create a table bluenosebex Mail Merge 5 08-02-2015 05:34 PM
Rule to turn off a rule tiger10012 Outlook 2 02-23-2013 09:50 AM
Help to create a rule Create Rule to forward message to mobile# JoyConner Outlook 1 04-21-2011 05:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft