Jumat, 06 Februari 2015

[MS_AccessPros] Email Report in body of email message

 

Hello everyone,

I have worked on this all day. Literally all day. We send reports all the time that are embedded into a message but the code does some loops and some other things are more than I need. I tried to adapt our code to work with one report and one recipient. And nothing I do is working. I am not sure why I keep getting errors that the objects are not defined. The latest code is below and the error is a compile error which is User-defined type not defined. it stops on the line Dim appOutLook As Outlook.Application

Is there something I do not see?


Private Sub cmdEmailAccomplishmentListReport_Click()
        Dim mess_body As String
        Dim appOutLook As Outlook.Application
        Dim MailOutLook As Outlook.MailItem
        Set appOutLook = CreateObject("Outlook.Application")
        Set MailOutLook = appOutLook.CreateItem(olMailItem)
           
            Set appOutLook = CreateObject("Outlook.Application")
            Set MailOutLook = appOutLook.CreateItem(olMailItem)
            With MailOutLook
            '.BodyFormat = olFormatRichText
            .To = "luvmymelody@yahoo.com"
            .Subject = "report"
            .HTMLBody = ("rptAccomplishmentList")
         If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
             .Attachments.Add "U:\rptAccomplishmentList.html"
      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

I am using early binding if that matters.

Sub CheckBindingLB()
    Dim olApp As Object
    Set olApp = CreateObject("Outlook.Application")
    MsgBox olApp.Name
End Sub

 
Jim Wagner

__._,_.___

Posted by: Jim Wagner <luvmymelody@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar