- Codice: Seleziona tutto
Sub PROVAMAIL2007()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String
Dim BodyText As String
Const LF = vbCrLf
' (a)
PERCORSOFILEIMMAGINE = """C:\io.JPG"""
Set OutApp = CreateObject("Outlook.Application")
Outfile = Cells(Range("G4").Value, "O").Value
For I = 5 To Range("H100").End(xlUp).Row
BDT = BDT & Cells(I, "H") & LF
Next I
'' (b)
Nominat = Cells(Range("G4").Value, "A").Value
EmailAddr = Cells(Range("G4").Value, "B").Value
Subj = Range("H4").Value
'
EmailAddr1 = Cells(Range("G4").Value, "C").Value
Subj = Range("H4").Value
EmailAddr2 = Cells(Range("G4").Value, "D").Value
Subj = Range("H4").Value
'
IMMAGINE = "<BR>" & "<img src=" & PERCORSOFILEIMMAGINE & "/></b><br>"
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = EmailAddr
.CC = EmailAddr1 & ";" & EmailAddr2
.BCC = ""
.Subject = Subj
If Cells(Range("G4").Value, "O").Value <> "" Then
.Attachments.Add Outfile
End If
.htmlBody = BDT & IMMAGINE
'.send
.Display 'or use .send
'.send
End With
' (c)
Set OutMail = Nothing
'
' (d)
Set OutApp = Nothing
End Sub
Funziona tutto bene se non per il fatto che non riesco a cambiare i l carattere predefinito nella mail. In poche parole ho impostato il carattere desiderato (Segoe UI 11) come suggerito qui https://support.office.com/it-it/article/Impostazione-del-tipo-di-carattere-o-del-colore-del-testo-per-i-messaggi-da-inviare-83425b7b-4acc-4e94-8c04-fa1e31790318 ma quando invio con excel mi invia con Times New Roman 12. Potreste aiutarmi per favore?
PS Se invece invio tramite Microsoft Outlook funziona tutto bene nel senso che i caratteri sono quelli da me impostati