Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change macro to send chart item to outlook email?


Hi,

I have below macro which I can able to get blank message to outlook email. I would need to add chart item to this macro so that I need to get the chart item automatic to outlook receipent email. can anyone help me please how to change the below macro

function MailReport()

    Dim objEmail

    Const cdoSendUsingPort = 2     ' Send the message using SMTP

    Const cdoAnonymous = 0     'Do not authenticate

    Const cdoBasic = 1         'basic (clear-text) authentication

    Const cdoNTLM = 2         'NTLM

    SMTPServer = "cfsmail.cfsusint.com"

    Const SMTPPort = 12                 ' Port number for SMTP

    Const SMTPTimeout = 60              ' Timeout for SMTP in seconds

    'Sending mail

    Set objEmail = CreateObject("CDO.Message")

    Set objConf = objEmail.Configuration

    Set objFlds = objConf.Fields

    With objFlds

        '---------------------------------------------------------------------

           ' SMTP server details

           .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort 'ok

           .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer      'ok

           .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic  'ok

          

           .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxyyy"

           .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"         

             .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort

           .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

           .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout

           .Update

        '---------------------------------------------------------------------

    End With

    objEmail.To = "keranaraf.adam@uk.cfs.com"        'Email Recipient

    objEmail.From = "a@Reporting"                        'Email Sender

    objEmail.Subject = "Dashboard"                        ' Subject

    objEmail.TextBody = "Body"        'Text Body         

   

    objEmail.Send

    Set objFlds = Nothing

    Set objConf = Nothing

    Set objEmail = Nothing

end function

I have a straight table with object ID CH12

Thanks.

1 Solution

Accepted Solutions
fkeuroglian
Partner - Master
Partner - Master

Hi,

First of all you have to export and save in some root, and then you have to atached this saved object in the email

add this to your macro:

//root of the attached object

fln2 = "E:\TestPDF\Reporte2.pdf"

and before send add this:

//atach the object to the mail

objMsg.AddAttachment   fln2

good luck!

Fernando

View solution in original post

2 Replies
fkeuroglian
Partner - Master
Partner - Master

Hi,

First of all you have to export and save in some root, and then you have to atached this saved object in the email

add this to your macro:

//root of the attached object

fln2 = "E:\TestPDF\Reporte2.pdf"

and before send add this:

//atach the object to the mail

objMsg.AddAttachment   fln2

good luck!

Fernando

Not applicable
Author

Thanks. It's working.