bonjour,
solution pour attachment
à tester,
Sub test()
Dim rng As Range
da = Sheets("sheet1").Range("B" & Rows.Count).End(xlUp).row
For Each rng In Sheets("Sheet1").Range("a2:a" & da)
If Application.WorksheetFunction.Text(VBA.Now() - rng.Offset(0, 1).Value, "[HH]") * 1 > 48 And rng.Offset(0, 2).Value = "" Then
Call send_email(rng.Value, rng.Row)
End If
Next
End Sub
Sub send_email(emailto As String, ROWNO As Long)
Dim noSession As Object
Dim noDatabase As Object
Dim noDocument As Object
'Instantiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
With noDocument
.Form = "Memo"
.SendTo = "otmano@gmail.com"
.Subject = "Alarme non validation projet dans la ligne " & ROWNO
.Body = "Bonjour," & vbNewLine & vbNewLine & vbNewLine & "Pensez SVP a valider le dossier dans la ligne " & ROWNO & vbNewLine & vbNewLine & vbNewLine & " Cordialement"
.SaveMessageOnSend = True
.PostedDate = Now()
fileattach="c:\document.txt" ' nom du fichier à joindre
Set Am = .CreateRichTextItem("Pièce_jointe")
Set Eo= Am.embedobject(1454, "Pièce_jointe",fileattach, "")
.Send 0, emailto
End With
set Am=nothing
set Eo=nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
End Sub