stop caution dialog onNewMail

G

Guest

I have some VB code in the ThisOutlookSession where everytime I get a new
email, it checks to see if it is from a certain user. If it is from that
user, the VB code will save the attachment to a directory.
The problem is, everytime I get an email, I get a warning dialog box that
says:
Microsoft Outlook
A program is trying to access e-mail addresses you have stored in Outlook.
Do you want to allow this?
If this is unexpected, it may be a virus and you should choose "No."
Allow access for 1 minute (or 2, or 5, or 10).
Yes/No/Help

It's a bother to have to click on this time every time I get an email, I get
about 10-20 emails a day. But I would like to be able to use this program, so
when I get the email from these two people every day, I don't have to spend a
minute or so to save to the directory.
Is there a way I can stop this caution dialog box?
My code is:
Dim WithEvents myOlApp As Outlook.Application
Private Sub Application_Startup()
Call Initialize_handler
End Sub
Sub Initialize_handler()
Set myOlApp = CreateObject("Outlook.application")
End Sub
Private Sub myOlApp_NewMail()
Dim myExplorers As Outlook.Explorers
Dim myFolder As Outlook.MAPIFolder
Dim MyItem As Object
Set myExplorers = myOlApp.Explorers
Set myFolder = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set MyItem = myFolder.Items(1)
Dim myattachments As Attachments
Set myattachments = MyItem.Attachments
If MyItem.SenderName = "Smith, John" Then
blah blah
End if
....
Thanks very much.
 
M

Michael Bauer

Am Thu, 2 Feb 2006 09:40:33 -0800 schrieb Ian Elliott:

In OL 2003, replace all "myOlApp" words by "Application", delete the "Dim
WithEvents" declaration, the "Initialize_handler" and the call of it.
 
G

Guest

Thanks Michael,
but I tried that, and in my OL 2002 it didn't work. It shouldn't, right?
Or did I maybe mess up changing it, and it should work in OL 2002.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top