Moi j'ai bien 2 lignes en désactivant tout ce qui est outlook.
Le (nouveau) soucis (nouveau car auparavant je n'avais bien qu'un seul enregistrement dans debug.print) est bien lié à Outlook.
Il faut créer l'instance Olmail à l'intérieur de la boucle. Essaie ceci :
Sub Grant_Reminders()
Dim spS As Worksheet
Dim spP As Range
Dim la As Range
Dim tblReport() As Variant
Dim project_ID As Variant
Dim period_ID As Variant
Dim acronym_Row As Variant
Dim acronym As Variant
Dim prem As String
Dim i As Long, j As Long
Dim n As Long
Dim destinataires As String, result, destination, fichier, staff
Dim mailing()
Const decalage As Integer = 7 '(de A à H)
Const tableName$ = "T_Reports"
Dim nb_persons As Integer
Dim Ol As New Outlook.Application
Dim Olmail As MailItem
Set Ol = New Outlook.Application
Dim CurrFile As String
tblReport = Worksheets("Reporting").Range("A1").CurrentRegion.Value
For i = 2 To UBound(tblReport) ' on ne prend pas les en-têtes
If tblReport(i, 7) > Now And tblReport(i, 7) <= Now + 55 And tblReport(i, 10) = "N" Then
n = 0
project_ID = tblReport(i, 1)
period_ID = tblReport(i, 2)
acronym_Row = Application.Match(project_ID, Worksheets("Projects").Range("A:A"), 0)
If Not IsError(acronym_Row) Then
acronym = Worksheets("Projects").Cells(acronym_Row, 3).Value
Set spS = ThisWorkbook.Worksheets("Staff")
Set spP = spS.Range("A1:A" & spS.Range("A" & Rows.Count).End(xlUp).Row)
With spP
Set la = .Find(project_ID, LookIn:=xlValues)
If Not la Is Nothing Then
prem = la.Address
Do
If la.Offset(0, decalage) = period_ID Then
n = n + 1
ReDim Preserve mailing(1 To n) 'Redimentionnement du tableau (ne pas typer)
mailing(n) = spS.Cells(la.Row, 4).Value & "/" & spS.Cells(la.Row, 3).Value & "/" & acronym & "/" & period_ID
End If
Set la = .FindNext(la)
Loop While la.Address <> prem
End If
End With
End If
If n = 0 Then
MsgBox "mailing est vide"
Else
Set Olmail = Ol.CreateItem(olMailItem)
destinataires = ""
For j = 1 To UBound(mailing)
result = Split(mailing(j), "/")
destinataires = destinataires & result(0) & "." & result(1) & "@mail.fr;"
staff = staff & "- " & result(0) & " " & result(1) & "<br>"
Next
With Olmail
.To = destinataires
.Subject = "Grant Office Reminders"
.Body = "Projet: " & result(2) & vbCrLf & vbCrLf & "Fin de période: " & fin_periode & vbCrLf & vbCrLf & "Période concernée: " & result(3) & vbCrLf & vbCrLf & "Ceci est un mail automatique de mon fichier de suivi."
Debug.Print i, project_ID
For j = 1 To UBound(mailing)
result = Split(mailing(j), "/")
destination = ThisWorkbook.Path & "\Projects_Library\" & result(2) & "-" & project_ID & "\Reporting\"
fichier = "FH (" & result(2) & ")-P" & result(3) & "-" & result(0) & " " & result(1) & " (PP)-vierge.xlsm"
.Attachments.Add (destination & fichier)
Debug.Print "", "", mailing(j)
Next
.DeleteAfterSubmit = True
.Display
End With
End If
End If
Next i
End Sub