Buona sera a tutti.
Chiedo cortesemente se qualcuno di voi mi può aiutare.
Ho una maschera dove ho inserito vari dati, nella quale ho creato un pulsante per inviare una email.
il pulsante , mi apre un report, lo trasforma in pdf e lo salva in una cartella dove ho il Db., e in base ad indirizzo email che ho in una casella di testo ( txtemail ) nella maschera mi invia l'email.
Questo è il codice Pulsante :
Private Sub Comando60_Click()
DoCmd.OpenReport "STAMPA ISTRUZIONE", acViewPreview, , "ID=" & Me!ID
DoCmd.OutputTo acReport, "STAMPA ISTRUZIONE", acFormatPDF, CurrentProject.Path & "\PDF ADDESTRAMENTO CENTRALE" & "PDF ADDESTRAMENTO CENTRALE.PDF", False
DoCmd.Close acReport, "STAMPA ISTRUZIONE"
With Me.txtemail
If Len(.Value & vbNullString) = 0 Then
.BackColor = vbRed
VBA.MsgBox prompt:="ATTENZIONE INSERIRE INDIRIZZO EMAIL !!!", _
buttons:=vbCritical + vbYesNo, _
title:="Informazione"
.BackColor = vbWhite
Exit Sub
End If
End With
Dim OutApp As Object ' late binding
Dim OutMail As Object ' late binding
Dim strMsg As String ' contiene il testo del messaggio
Dim strDest As String ' contiene l'indirizzo email
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0) ' creo una email vuota
strDest = txtemail
With OutMail
.To = strDest
.CC = ""
.BCC = ""
.Subject = "avviso"
.HTMLBody = strMsg
.Send
VBA.MsgBox prompt:=" EMAIL INVIATA !!!!", _
buttons:=vbInformation, _
title:="Informazione"
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Ora vi chiedo come posso fare per allegare il report (trasformato in pdf ),cosa devo aggiungere nel codice?
grazie.
Pierluigi.