PC Review


Reply
Thread Tools Rate Thread

How to disable outlook alert message in VB code?

 
 
=?Utf-8?B?TWljcm9sb25nwq4=?=
Guest
Posts: n/a
 
      3rd Aug 2005
Currently I encountered a problem when I attempt to access outlook email
address book.
I use VB6 code call cdo 1.2.1 object. The mails address need to resolve.
however I got dialogue box while resolving the email address. The Alert
message said: A program is try to access email-address you have stored in
outlook. Do you want to
allow this?
My code is as follows:

Private Sub Form_Load()
'Body of email message
Dim msgBody As String
Dim msgMailReceiver
msgBody = "A mail for test"
msgMailReceiver = "v-dawang"
'Call our function with recipient, message and subject
MySendMail msgMailReceiver, msgBody, "Automated Message."
MsgBox "Deliever OK!!"
Unload Me
End Sub
Sub MySendMail(recipient, msg, subject)
On Error GoTo errorhandle
Dim objSession, oInbox, colMessages, oMessage, colRecipients
Dim strProfile As String
Set objSession = CreateObject("MAPI.Session")
strProfile = "default outlook profile"
If strProfile <> "" Then
objSession.Logon strProfile
Else
Exit Sub
End If
Set oInbox = objSession.Inbox
Set colMessages = oInbox.Messages
Set oMessage = colMessages.Add()
Set colRecipients = oMessage.Recipients
colRecipients.Add recipient
colRecipients.Resolve (True) '(Dialogue will raise!)
oMessage.subject = subject
oMessage.Text = msg
oMessage.Send
objSession.Logoff
Set objSession = Nothing
Exit Sub
errorhandle:
MsgBox "Input error!!"
End Sub

Welcome any suggestion!!
thanks.
Microlong
--
Developer
QA Dashboard
Microsoft China Development Centre
 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      3rd Aug 2005
See http://www.outlookcode.com/d/sec.htm for your options with regard to the "object model guard" security in Outlook 2000 SP2 and later versions.


--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Microlong®" <(E-Mail Removed)> wrote in message news:AD43A9CD-3F25-40F9-97C5-(E-Mail Removed)...
> Currently I encountered a problem when I attempt to access outlook email
> address book.
> I use VB6 code call cdo 1.2.1 object. The mails address need to resolve.
> however I got dialogue box while resolving the email address. The Alert
> message said: A program is try to access email-address you have stored in
> outlook. Do you want to
> allow this?
> My code is as follows:
>
> Private Sub Form_Load()
> 'Body of email message
> Dim msgBody As String
> Dim msgMailReceiver
> msgBody = "A mail for test"
> msgMailReceiver = "v-dawang"
> 'Call our function with recipient, message and subject
> MySendMail msgMailReceiver, msgBody, "Automated Message."
> MsgBox "Deliever OK!!"
> Unload Me
> End Sub
> Sub MySendMail(recipient, msg, subject)
> On Error GoTo errorhandle
> Dim objSession, oInbox, colMessages, oMessage, colRecipients
> Dim strProfile As String
> Set objSession = CreateObject("MAPI.Session")
> strProfile = "default outlook profile"
> If strProfile <> "" Then
> objSession.Logon strProfile
> Else
> Exit Sub
> End If
> Set oInbox = objSession.Inbox
> Set colMessages = oInbox.Messages
> Set oMessage = colMessages.Add()
> Set colRecipients = oMessage.Recipients
> colRecipients.Add recipient
> colRecipients.Resolve (True) '(Dialogue will raise!)
> oMessage.subject = subject
> oMessage.Text = msg
> oMessage.Send
> objSession.Logoff
> Set objSession = Nothing
> Exit Sub
> errorhandle:
> MsgBox "Input error!!"
> End Sub
>
> Welcome any suggestion!!
> thanks.
> Microlong
> --
> Developer
> QA Dashboard
> Microsoft China Development Centre

 
Reply With Quote
 
Dan Mitchell
Guest
Posts: n/a
 
      3rd Aug 2005
"=?Utf-8?B?TWljcm9sb25nwq4=?=" <(E-Mail Removed)> wrote in
news:AD43A9CD-3F25-40F9-97C5-(E-Mail Removed):
> I use VB6 code call cdo 1.2.1 object. The mails address need to
> resolve. however I got dialogue box while resolving the email address.
> The Alert message said: A program is try to access email-address you
> have stored in outlook. Do you want to allow this?


See http://www.outlookcode.com/d/sec.htm

-- dan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disable message box during VBA code execution juergenkemeter Microsoft Excel Programming 2 12th Jan 2006 01:16 AM
Ms Outlook Message alert =?Utf-8?B?c29zYWs=?= Windows XP General 1 1st Jun 2005 07:50 PM
Disable alert message when merging cells?? yung Microsoft Excel Programming 1 10th Mar 2005 02:57 AM
How to disable MS outlook alert message? =?Utf-8?B?Qm9ybg==?= Microsoft Outlook Discussion 1 20th Oct 2004 07:04 AM
Outlook displays alert to user when I run my code Amin Sobati Microsoft Outlook VBA Programming 2 9th Mar 2004 02:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:51 AM.