![]() |
|
#4
|
||||
|
||||
|
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 |
|
|
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 |
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 |
Create Rule to forward message to mobile#
|
JoyConner | Outlook | 1 | 04-21-2011 05:44 PM |