avoid security messages when automating outlook using access 2003

G

Guest

Hi

I have been on these boards the last few days try to learn how to do this,
but i am unable.

i have successfully adapted code (thanks to the MSDN) that does exactly what
i need, e.g. send an email from microsoft access. however i get all these
warnings messages and i would like to get rid of them. i read up a lot of
postings on MSDN but i have no answers. plesae let me know what i can do
about it. i will post my code so that you can see what i am doing. btw, i am
also getting some message "type mismatch" which i can't figure out where it
comes from.

here is my code. (its on a form as a seperate subroutine)
Sub sbSendMessage(Optional AttachmentPath)
On Error GoTo Err_ErrorMsgs

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message. Substitute
' your names here.
Set objOutlookRecip = .Recipients.Add(Me.txtEmailAddress)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("(e-mail address removed)")
objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = Me.txtFacility.Column(0) & " Systems Audit " & Date
.Body = Me.txtEmailBodyText
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
'For Each objOutlookRecip In .Recipients
'If Not objOutlookRecip.Resolve Then
'objOutlookMsg.Display
'End If
'Next
.Display
'.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Err_ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
" Rerun the procedure and click Yes to access e-mail" & _
" addresses to send your message. For more information," & _
" see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp. "
Else
MsgBox Err.Number, Err.Description
End If
End Sub

thanks,

sam
 
G

Guest

thanks for your quick response. can you please explain what i should do with
this link. i already have seen it but i still don't know what i should do,
what i should instal, and what will work for office 2003. sorry i am not so
familiar with this.

thanks,

sam
 
S

Sue Mosher [MVP-Outlook]

John's solution applies only if you use Exchange for mail, have a cooperative Exchange administrator, and are willing to sacrifice some security for the sake of your application. It would be up to the Exchange administrator to implement it.

I would suggest instead that you review the available solutions at http://www.outlookcode.com/article.aspx?ID=52 and decide which one is most appropriate for your version of Outlook and the type of code or application that you are writing.
 
G

Guest

Thank a lot. i am using now CDO. i got it to work in no time, i have only one
issue. i am trying allow the user to view the email before it is sent out. is
this possible?

thanks,

Sam
 
G

Guest

Hi Sue,

Thanks for all your replies, i really appreciate it. ok, i now know of 3
methods to send email from access.
1. docmd.sendobject
2. automate using access
3. cdo windows

none of these seem to be optimal.
1. doesn't have enough options (attahcments)
2. has too many error messages to which i have not seen any solution.
3. i will probably be able to figure out the signature part (i'll send html
in the body), but i am still struggling having all computers be able to send.
for some reason some computers are having problems. i am working with my
admin to resolve this. as far as the UI, not sure what you mean i should have
my own UI. i think for the most part i don't need to see the message before
it leaves, but it would be nice to have that option available. i was told
that its impossible.

please help me with any input you might have. is there another method which
i should explore? also, i would love to automate, i am very succesful with
Word and Excel. i would love to have a full functioning outlook. just don't
know how to get rid of the errors. (i saw there is a .dll file, but thats
complicated, and i don't know if it works in oulook with out exchange.

thanks,

sam
 
S

Sue Mosher [MVP-Outlook]

If it were my project, I'd use Outlook automation, as in your code below, + Outlook Redemption (see the URL I posted earlier) to handle the security prompts. You can also use Outlook objects, without resolving recipients, and display the message instead of sending it

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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