Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

custominsing e-mail message alert in outlook using VBA 1

Status
Not open for further replies.

spurs100

Technical User
Jun 5, 2002
20
GB
Hi all!

i dont know if this can be done, i am reletively new to VBA.

Is it possible to customise the email notification message that pops up across your screen when a new email arrives from a certain address, i would like to create a message notification that says you have new mail from joe@bloggs.com

hope someone can help if its not too complicated.

thanks in advance

 
The MsgBox that is displayed is part of the Outlook application and i'm almost certain it can't be altered.

You've probably got one option to find out who it's from and thats to click yes to "read it now?".

Not very helpful i know, sorry.



Leigh Moore
LJM Analysis Ltd
 
i think away around that is to create your own form with its own message i think?

what about creating a vba form which only appears if the new mail is from a certain address.

I found something close to what i am trying to achieve but not sure how to proceed after creating the form.


see section: Using NewMail to trigger a new mail pop-up

hope you can help

thanks
 
Right, you need to create a module for the NewMail event...

Private Sub Application_NewMail()

Code to capture senders name here.

End Sub

This would work in theory, but i've no idea how you'd capture the senders name on a new mail, especially if you receive more than one at any one time.

Sorry i couldn't be more help, Outlook is not my best subject.

Leigh Moore
LJM Analysis Ltd
 
I think this will do what you want:

Private Sub Application_NewMail()
Dim objItem As Outlook.MailItem

Set objItem = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items(1)
'
' This will pop up on every new e-mail:
MsgBox "You have new mail from " & objItem.SenderName
'
' This will pop up only on e-mails from "joe@bloggs.com":
If objItem.SenderName = "joe@bloggs.com" Then
MsgBox "You have new mail from " & objItem.SenderName
End If
End Sub


-Hope this helps!

Glenn
 
Glen,

That is excatly what i was looking for thanks for your help, only one problem, every time i recieve a new mail the code excutes but i get a box appearing with the following message

"A program is trying to access email addresses you have stored in Outlook, do you want to allow this"

Is there any way to bypass this message as i have to keep clicking yes for the code to work.

Thanks in advance

Rob
 
Hmm... I don't get that on mine. I have my securiy level set at "medium" (from Outlook, click Tools, Macro, Security to check / change the levels)... is your level set on "high"?

Glenn
 
i have tried changing the security setting to meduim but it keeps reverting back to high. Do you have the latest security patch installed? i have read around and found out that this is the cause of the message.

I have tried to sign the macro however it does tell me it is not from a trusted source. I have to install the certificate in the trusted root certificate authorities store for it to become a trusted source, any ideas how this is done?

maybe this will help??

hope you can help,

thanks

Rob
 
Wow... I've never come across this before. I was able to sign my Outlook macros using the same digital certificate that I use for my Excel projects. I'm afraid my usefulness to you has run out.

Hopefully one of the many geniuses we have here will be able to clear this up for us.

-Glenn
 
glenntb,

Thanks for sharing. Here is a Star, I'm having fun expanding upon your code snippet.

Much Thanks!



LikeThisName <- ? Sorry It's Taken =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top