Private Sub Comando29_Click()
'
https://youtu.be/6fu0kXXU_R4 - MANDARE EMAIL CON ACCESS
Dim OutApp As Object
Dim OutMail As Object
Dim strMsg As String
Dim strDest As String
Dim strAllegato As String
Set OutApp = CreateObject("outlook.application")
Set OutMail = OutApp.CreateItem(0)
strMsg = "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>"
strMsg = strMsg & "<html>"
strMsg = strMsg & "<head>"
strMsg = strMsg & " <meta content='text/html; charset=ISO-8859-1'"
strMsg = strMsg & " http-equiv='content-type'>"
strMsg = strMsg & " <title></title>"
strMsg = strMsg & "</head>"
strMsg = strMsg & "<body>"
strMsg = strMsg & "<span style='font-weight: bold;'>Spett.</span><br>"
strMsg = strMsg & "<br>"
strMsg = strMsg & "i dati sono:<br>"
strMsg = strMsg & "<br>"
strMsg = strMsg & "<table style='text-align: left; width: 100%;' border='1'"
strMsg = strMsg & " cellpadding='2' cellspacing='2'>"
strMsg = strMsg & " <tbody>"
strMsg = strMsg & " <tr>"
strMsg = strMsg & " <td>ffff</td>"
strMsg = strMsg & " <td>fff</td>"
strMsg = strMsg & " <td>fff</td>"
strMsg = strMsg & " <td>fff</td>"
strMsg = strMsg & " </tr>"
strMsg = strMsg & " <tr>"
strMsg = strMsg & " <td><p align='center'><strong>" & Format(DESCRIZIONE_ELABORATO, "Standard") & "</strong></p> </td>"
' Ottieni il percorso dell'allegato
strAllegato = CurrentDb.OpenRecordset("02_TAB_REV").Fields("Prog ettazione").Value
' Aggiungi l'allegato alla email
OutMail.Attachments.Add FileName:=strAllegato
strMsg = strMsg & "</tbody>"
strMsg = strMsg & "</table>"
strMsg = strMsg & "<br>"
strMsg = strMsg & "<br>"
strMsg = strMsg & "saluti,<br>"
strMsg = strMsg & "</body>"
strMsg = strMsg & "</html>"
strDest = txtEmail ' variabile email
With OutMail
.to = strDest
.cc = ""
.bcc = ""
.subject = "scad pag"
.HTMLBody = strMsg
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub