1

My aim is to generate a mail.

The code does work, except for the attachment. "File settimanale" is a variant containing the path of the ppt I want to attach.

Has someone a solution?

    'First, select the body format as olFormatHtml.
    .BodyFormat = olFormatHTML
    
    'Now display the email.
    .Display
    
    'write the email in the body of the email
    .HTMLBody = "Buongiorno Giacomo, " & "<br>" & "<br>" & "Invio in allegato il monitoraggio settimanale di Neafidi al " & DataCons & "<br>" & "<br>" & "Grazie e buon proseguimento," & .HTMLBody
    
    'Invio la mail al seguente indirizzo
    .To = MailInvio
    .CC = MailInvioCC
    
    'Inserisco oggetto della mail
    .Subject = SoggettoMail
    
    'Inserisco allegato nella mail
    .Attachment = FileSettimanale
    
End With
chris neilsen
  • 52,446
  • 10
  • 84
  • 123
  • 1
    Should be `.Attachments.Add` [Attachments.Add method (Outlook)](https://learn.microsoft.com/en-us/office/vba/api/outlook.attachments.add) – 0m3r Dec 22 '22 at 14:45

0 Answers0