1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
Sub SendMeMail()
Dim t As Range
Sheets("Feuil1").Select
'Set t = Range("A1:C12")
Range("A1:C12").Select
Selection.Copy
Dim oSession As Object
Dim oDB As Object
Dim oDoc As Object
Dim sMsg As String, sMyAttachment As String
Dim oRichTextItem As Object
Dim Destinat1 As Variant
Dim Destinat2 As Variant
Dim TabSend(2 To 255)
Dim TabCopy(2 To 255)
Dim CopyLimit As Integer
Dim SendLimit As Integer
sMyAttachment = "H:\temp\" & activesheet.name
Const EMBED_ATTACHMENT = 1454
'open mail session and set up mail document
Set oSession = CreateObject("Notes.NotesSession")
Set oDB = oSession.GetDatabase("", "")
Call oDB.OpenMail
Set oDoc = oDB.CreateDocument
Destinat1 = Array("moi@moi.fr")
oDoc.sendto = Destinat1
Call oDoc.ReplaceItemValue("Subject", "Service request stil open le " & _
DateHeure2)
'create body text
Set oRichTextItem = oDoc.CreateRichTextItem("Body")
sMsg = "Bonjour, Voici l'évolution du backlog depuis le " & OldDay & "." _
& OldMonth & "." & OldYear & " à " & OldHour & " : " & obs & "(" _
& obs - OldObs & ")" & vbCrLf & vbCrLf
' vbCrLf = retourchariot + saut de ligne"
sMsg = sMsg & t.Paste
Call oRichTextItem.AppendText(sMsg)
' Call oRichTextItem.EmbedObject(1453, "", t)
'attach attachment
'Call oRichTextItem.EmbedObject(EMBED_ATTACHMENT, "", sMyAttachment)
'create body text
sMsg = vbCrLf & vbCrLf & "Cordialement"
Call oRichTextItem.AppendText(sMsg)
'send
oDoc.SaveMessageOnSend = True
Call oDoc.Send(False)
Set oSession = Nothing
'MsgBox "Email sent.", vbOKOnly + vbInformation
End Sub |
Partager