Getting Missing: Microsoft Outlook 14.0 Library on user's machine

Hello,

I am getting the following reference error when a user is trying to send a email from Excel via automation.  The problem is that I am used late binding in writing the email code.  So why am I still getting that error

Getting Missing: Microsoft Outlook 14.0 Library on user's machine

How
' Module     : basSendMail
' Description:
' Procedures : SendMail(strRecipients As String, strCC As String, strBCC As String, strSubject As String, strTextBody As String, strHTMLBody As String, strAttachments As String, Optional eOlImportance As Integer = 1, Optional fDisplay As Boolean = True) As Boolean
' Modified   :
' 08/16/13 JV Cleaned with Total Visual CodeTools
'
' --------------------------------------------------
Option Explicit

Public Function SendMail(strRecipients As String, strCC As String, strBCC As String, strSubject As String, strTextBody As String, strHTMLBody As String, strAttachments As String, Optional eOlImportance As Integer = 1, Optional fDisplay As Boolean = True) As Boolean
    ' Comments: Sends a message using the following properties : Recipients, CC, BCC, SubjectBody, Delimiter
    ' Params  : strRecipients       List of recipients (TO address)
    '           strCC               List of carbon copy (CC) recipients
    '           strBCC              List of blind carbon copy (BCC) recipients
    '           strSubject          Subject of email
    '           strTextBody         Text Body of email, if any
    '           strHTMLBody         HTML body of email, if any
    '           strAttachments      List of attachment files (separated with the delimiter character which defaults to ;)
    '           eOIImportance       Importance of the email (defaults to olImportanceNormal, can also be olImportanceHigh, olImportanceLow)
    '           fDisplay            True to display the Mail Dialog, False otherwise. Default value is False.
    ' Returns : True if sent, False if failed
    ' Source  : Total Visual SourceBook
    
    On Error GoTo PROC_ERR
    
    Dim astrTmpAttachments() As String
    Dim intCount As Integer
    Dim strM_strDelimiter As String
    Dim objOOutlook As Object
    Dim objOutMailItem As Object
    Dim objOutAttachments As Object
    
    strM_strDelimiter = ","
    
    Set objOOutlook = CreateObject("Outlook.Application")
    ' Assume failure
    SendMail = False
    
    ' Create new instance of Outlook MailItem Object for you to work with.
    Set objOutMailItem = objOOutlook.CreateItem(0)          'You must use 0 instead of olMailItem with late-binding
    
    With objOutMailItem
        .To = strRecipients
        .CC = strCC
        .BCC = strBCC
        .Subject = strSubject
        .Body = strTextBody
        If strHTMLBody <> "" Then
            .HTMLBody = strHTMLBody
            .BodyFormat = 2   'olFormatHTML
        Else
            .BodyFormat = 1   'olFormatPlain
        End If
        .Importance = eOlImportance
        
        ' Parse Attachments and Add them to the Attachments Collection
        If strAttachments <> "" Then
            Set objOutAttachments = .Attachments
            astrTmpAttachments = Split(strAttachments, strM_strDelimiter)
            For intCount = 0 To UBound(astrTmpAttachments)
                objOutAttachments.Add astrTmpAttachments(intCount), 1  'olByValue
            Next intCount
        End If
        If fDisplay Then
            .Display
        End If
        
        .Send
        
    End With
    
    SendMail = True
    
PROC_EXIT:
    Exit Function
    
PROC_ERR:
    MsgBox "Error: " & Err.Number & ". " & Err.Description, , "COutlookMail.SendMail"
    Resume PROC_EXIT
End Function

Open in new window

Juan VelasquezAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Hi,

As this ever worked or this is just new?

Are the windows and MS patches update?

Can you check to see if the Microsoft Outlook 14.0 Object Library (Go to add reference --> COM tab --> Look for 'Microsoft Outlook 14.0 Object Library').

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Juan VelasquezAuthor Commented:
I found the problem.  I had inadvertently checked the Microsoft Outlook 14.0 Object Library  before I distributed it .  Consequently,  when an Excel 2007 user opened the application, he received a error message.  Since I'm using late binding, I unchecked the Microsoft Outlook Object library reference, and everything is working fine
0
Juan VelasquezAuthor Commented:
Your answer put me on the right track
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.