Results 1 to 4 of 4
  1. #1
    reptile is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    2

    Sending email from access to outlook...gives permission denied

    Hi,


    I'm writing some code for my company to send emails from access 2007 to outlook, the problem is that after a certain point it gives me a runtime error 70, "permission denied" message. Here is a very simple code I have below which is from another site, after the line:
    "Set appOutLook = Outlook.Application"...it always says "Permission Denied", can anyone shed some light here...also remember their isn't much I can do in outlook because I'm not the administrator... Thanks in advance:

    Private Sub Command20_Click()

    Dim mess_body As String
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = Outlook.Application
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .BodyFormat = olFormatRichText
    .To = Me.Email_Address
    .Subject = Me.Mess_Subject
    .HTMLBody = Me.Mess_Text
    If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
    .Attachments.Add (Me.Mail_Attachment_Path)
    End If
    '.DeleteAfterSubmit = True 'This would let Outlook send th note without storing it in your sent bin
    .Send
    End With
    'MsgBox MailOutLook.Body
    Exit Sub
    email_error:
    MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
    Resume Error_out
    Error_out:
    End Sub

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    if you are not the administrator on the machine, that may play a part, but you might want to try code like this (dec section) just in case:

    Code:
    Dim mess_body As String
    Dim appOutLook As Outlook.Application
    Set appOutLook = new Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    Or maybe use CREATEOBJECT() instead of direct refernces?

  3. #3
    reptile is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    2
    Quote Originally Posted by ajetrumpet View Post
    if you are not the administrator on the machine, that may play a part, but you might want to try code like this (dec section) just in case:

    Code:
    Dim mess_body As String
    Dim appOutLook As Outlook.Application
    Set appOutLook = new Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    Or maybe use CREATEOBJECT() instead of direct refernces?
    Thanks for the reply, but I did try both ways you mentioned and still I sadly get the "permission denied" message...

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    check this out: http://mike.brisgeek.com/2007/01/11/...denied-errors/

    is it possible that a dll library you need is stored in a different location than usual, like what is in the example above? I don't have the answer for you, but you might want to look into that.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. sending gmail email through access
    By TheShabz in forum Programming
    Replies: 20
    Last Post: 02-19-2012, 12:24 PM
  2. Sending email
    By nashr1928 in forum Reports
    Replies: 8
    Last Post: 04-27-2010, 11:14 PM
  3. SENDING EMAIL MESSAGES DIRECTLY FROM ACCESS
    By Frenchos in forum Access
    Replies: 0
    Last Post: 07-20-2007, 12:51 AM
  4. Replies: 1
    Last Post: 03-09-2006, 01:50 PM
  5. Sending email via Outlook (and Exchange2003) from Access2003
    By Larry Elfenbein in forum Programming
    Replies: 0
    Last Post: 11-15-2005, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums