A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Avoid Security Prompts



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 31st 08, 06:28 PM posted to microsoft.public.outlook.program_vba
SHIPP
external usenet poster
 
Posts: 1
Default Avoid Security Prompts

I am using Access 2003 to automate an email. The following is my code.


Function sendMessage(strTo As String, strSubject As String, _
strComments As String, Optional AttachmentPath)

Dim objOutlookApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecipient As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlookApp = CreateObject("Outlook.Application")
' Set objOutlookApp = Application
' Create the message.
Set objOutlookMsg = objOutlookApp.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecipient = .Recipients.Add(strTo)
objOutlookRecipient.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = strSubject
.Body = strComments & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name
For Each objOutlookRecipient In .Recipients
objOutlookRecipient.Resolve
If Not objOutlookRecipient.Resolve Then
objOutlookMsg.Display ' Display any names that can't be resolved
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlookApp = Nothing

End Function

The email is sent but it prompts 6 times because of security. In a previous
comment to another user Sue Mosher indicated that the following line

Set objOutlookApp = CreateObject("Outlook.Application")

Should be changed to:

Set objOutlookApp = Application

I have tried this and now I get a Type Mismatch error. Any ideas on how to
eliminate the security questions would be appreciated.

--
M. Shipp
Ads
  #2  
Old January 31st 08, 06:36 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Avoid Security Prompts

Replacing objOutlookApp with Application would work if you were working from
Outlook VBA.
In case of Access, CreateObject("Outlook.Application") is the only option.
See http://outlookcode.com/article.aspx?id=52

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"SHIPP" wrote in message
...
I am using Access 2003 to automate an email. The following is my code.


Function sendMessage(strTo As String, strSubject As String, _
strComments As String, Optional AttachmentPath)

Dim objOutlookApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecipient As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlookApp = CreateObject("Outlook.Application")
' Set objOutlookApp = Application
' Create the message.
Set objOutlookMsg = objOutlookApp.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecipient = .Recipients.Add(strTo)
objOutlookRecipient.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = strSubject
.Body = strComments & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name
For Each objOutlookRecipient In .Recipients
objOutlookRecipient.Resolve
If Not objOutlookRecipient.Resolve Then
objOutlookMsg.Display ' Display any names that can't be resolved
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlookApp = Nothing

End Function

The email is sent but it prompts 6 times because of security. In a
previous
comment to another user Sue Mosher indicated that the following line

Set objOutlookApp = CreateObject("Outlook.Application")

Should be changed to:

Set objOutlookApp = Application

I have tried this and now I get a Type Mismatch error. Any ideas on how to
eliminate the security questions would be appreciated.

--
M. Shipp



  #3  
Old April 17th 08, 07:26 PM posted to microsoft.public.outlook.program_vba
viwow
external usenet poster
 
Posts: 1
Default Avoid Security Prompts

You can try this:
http://www.download3k.com/Install-Ad...r-Outlook.html



"SHIPP" wrote:

I am using Access 2003 to automate an email. The following is my code.


Function sendMessage(strTo As String, strSubject As String, _
strComments As String, Optional AttachmentPath)

Dim objOutlookApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecipient As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlookApp = CreateObject("Outlook.Application")
' Set objOutlookApp = Application
' Create the message.
Set objOutlookMsg = objOutlookApp.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecipient = .Recipients.Add(strTo)
objOutlookRecipient.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = strSubject
.Body = strComments & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name
For Each objOutlookRecipient In .Recipients
objOutlookRecipient.Resolve
If Not objOutlookRecipient.Resolve Then
objOutlookMsg.Display ' Display any names that can't be resolved
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlookApp = Nothing

End Function

The email is sent but it prompts 6 times because of security. In a previous
comment to another user Sue Mosher indicated that the following line

Set objOutlookApp = CreateObject("Outlook.Application")

Should be changed to:

Set objOutlookApp = Application

I have tried this and now I get a Type Mismatch error. Any ideas on how to
eliminate the security questions would be appreciated.

--
M. Shipp

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify Code Using Outlook Redemption to bypass security prompts mhgreene Outlook and VBA 5 October 3rd 07 11:50 PM
Avoid outlook security warning message. ashish taralekar Outlook - Using Forms 1 April 11th 07 06:06 PM
get reed of security prompts Kan Kan Outlook - General Queries 7 August 28th 06 03:27 PM
Another question about security prompts ML Outlook - Using Forms 1 March 22nd 06 05:45 PM
Is there a way to avoid needing to "allow" outlook security to send email? Mr . . Outlook - Using Forms 1 January 28th 06 03:18 PM


All times are GMT +1. The time now is 03:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.