How do you suppress the warning messages in Outlook when an application is programatically accessing

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hello,


I have Visual Basic 6 (Add-in Project) application that sends and
forwards email to another email address. That program works great and
has no problems. However, I need to determine how to suppress the
warning messages that come up in Outlook when my code is sending a
message (forwarding).


The exact message is "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"."


Then the same message comes up again (second time) followed by a third
message.

The third message is "A program is trying to automatically send e-mail
on your behalf. Do you want to allow this? If this is unexpected, it
may be a virus and you should choose "No"."

Again my program sends the selected email message to another email
address that the user types in. So, these messages are expected.


The exact code block I am using to send / forward an email is (this is
abbreviated):

Dim myItem As outlook.MailItem
Dim FWDItem As outlook.MailItem
Static strInput As String 'holds the email address entered by the user
'Input box function
Dim myRecipient As outlook.Recipient
Set myolapp = CreateObject("Outlook.Application")
Set myNameSpace = myolapp.GetNamespace("MAPI")
Set myItem = myolapp.ActiveInspector.CurrentItem 'opened email
Set FWDItem = myItem.Forward 'forward the email
strinput = InputBox("Enter email address to where you want to
forward this email message?", "Forward", "")
Set myRecipient = FWDItem.Recipients.Add(strInput)
FWDItem.Send

The first warning comes on the line set myRecipient =
FWDItem.Recipients.Add(StrInput). The second comes on the same line.
And finally the third message occurs on the line FWDItem.Send, when
the message is actually sent.

I would like to suppress these messages when my program / application
is sending / forwarding a message.

I am guessing that there is no way to suppress these warnings, but I
could be mistaken. The one exception is to select the "allow access"
checkbox for a period up to a 10-minute period – I would like to turn
it off while my program is running which is usually for the duration
of the Outlook Session until the user closes out Outlook. And of
course, the user would still see this first and second messages when
my program forwards an email for the first time, which again I am
trying to suppress. That is not a good solution.

Does anyone know how to do this? Any help is most appreciated. Thanks
again.
 
Back
Top