Share via

Error Code 429 - Integrate MS access with MS Outlook using VBA

Anonymous
2010-07-30T14:12:36+00:00

I have an MS Access application which sends out automatic emails using MS Outlook. For some reason it gives "Error 429 - Active X component can't create object" when I try to run it. I checked online help. There is not too many solutions. It asked me to check the dll files which i did nothing is missing. the last option was to reinstall MS Office. It still does not work. Has anybody else encountered the same error. Any help will be highly appreciated. I have been trying to fix this issue for 4 days now with no luck. On some computers it gives me "Error 438 - Object does not supoprt this property/method." whereas this application did work before. Any suggestions?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2012-02-16T15:02:37+00:00

    Hi , Its Its working :)

    But its not sending mail.

    I mean it create E-mail with all the data , but we have manually Send the mail.

    There must be SendMail Function tht has to be included in the Code , so that no need to click on Send button.

    I tired i m not able to include into , can u please chk and reply

    Many Thanks ....

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-07-30T20:06:58+00:00

    Try the following code and see if it works for you (you must reference the Microsoft Outlook 11.0 Object Library):

    Public Function SendOutlookEmail(sRecipient As String, Optional sSubject As String, Optional sBody As String, Optional bAutoSend As Boolean) As Boolean

    Dim objOutlook As Outlook.Application

    Dim objOutlookMsg As Outlook.MailItem

    Dim objOutlookRecip As Outlook.Recipient

    Dim mailRecipient As String, mailSubject As String, mailBody As String, mailAttach As String

    Dim fso

    On Error GoTo ErrorHandler

      Set fso = CreateObject("Scripting.FileSystemObject")

      Set objOutlook = CreateObject("Outlook.Application")

      Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

      mailRecipient = sRecipient & " "

      mailSubject = sSubject & " "

      mailBody = sBody & " "

      With objOutlookMsg

        Set objOutlookRecip = .Recipients.Add(mailRecipient)

        objOutlookRecip.Type = olTo

        .Subject = mailSubject

        .Body = mailBody

        If bAutoSend = -1 Then .Send Else objOutlookMsg.Display

      End With

      Set objOutlookMsg = Nothing

      Set objOutlook = Nothing

      Set objOutlookRecip = Nothing

      Set objOutlookAttach = Nothing

      Set fso = Nothing

      SendOutlookEmail = True

      Exit Function

    ErrorHandler:

      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.", vbExclamation

        'bypass with http://www.mapilab.com/outlook/security/

      ElseIf Err.Number = "2501" Then

        MsgBox "Email delivery has been canceled.", vbInformation

      Else

        MsgBox "Error " & Err.Number & " " & Err.Description

      End If

      SendOutlookEmail = False

    End Function

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-07-30T14:31:17+00:00

    following is the code and the line where it errors out. the line in bold is where the procedure errors out and i have selected the necessary libraries.

    Public Function FnSafeSendEmail(strTo As String, _

                       strSubject As String, _

                       strMessageBody As String, _

                       Optional strAttachmentPaths As String, _

                       Optional strCC As String, _

                       Optional strBCC As String) As Boolean

       Dim objOutlook As Object ' Note: Must be late-binding.

       Dim objNameSpace As Object

       Dim objExplorer As Object

       Dim blnSuccessful As Boolean

       Dim blnNewInstance As Boolean

       'Is an instance of Outlook already open that we can bind to?

       'On Error Resume Next

    Set objOutlook = GetObject(, Outlook.Application)

       'On Error GoTo 0

       If objOutlook Is Nothing Then

           'Outlook isn't already running - create a new instance...

           Set objOutlook = CreateObject("Outlook.Application")

           blnNewInstance = True

           'We need to instantiate the Visual Basic environment... (messy)

           Set objNameSpace = objOutlook.GetNamespace("MAPI")

           Set objExplorer = objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)

           objExplorer.CommandBars.FindControl(, 1695).Execute

           'objExplorer.Close

           Set objNameSpace = Nothing

           Set objExplorer = Nothing

       End If

       blnSuccessful = objOutlook.FnSendMailSafe(strTo, strSubject, strMessageBody, strCC, _

                                                  strBCC, strAttachmentPaths)

        Debug.Print FnSafeSendEmail

       FnSafeSendEmail = blnSuccessful

        Debug.Print blnSuccessful

       If blnNewInstance = True Then objOutlook.Quit

       Set objOutlook = Nothing

    End Function

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-07-30T14:20:40+00:00

    It is impossible for anyone here to help you without seeing your code.  Could you post the routine that is giving you the problem and identify which line the code is halting/causing the error at.

    Also, depending on your code, have you made sure you have all the necessary reference libraries selected?

    Daniel Pineault

    http://www.cardaconsultants.com

    Was this answer helpful?

    0 comments No comments