Private Sub Command4_Click()
'Macro to export data for reports
'Turn off Warnings
DoCmd.SetWarnings False
'Determine and set the path for the database location
Dim Path
Path = Application.CurrentProject.Path
Dim PMOLead(1 To 8)
PMOLead(1) = "abc1"
PMOLead(2) = "abc2"
PMOLead(3) = "abc3"
PMOLead(4) = "abc4"
PMOLead(5) = "abc5"
PMOLead(6) = "abc6"
PMOLead(7) = "abc7"
PMOLead(8) = "abc8"
For i = 1 To 8
txtPMOLead_Box = PMOLead(i)
Call txtPMOLead_Box_AfterUpdate
If LeadEmail.Value <> vbNullString Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "PastDue", Path & "\YTD Past Due_" & PMOLead(i) & "_" & ".xlsx", True
'sendemail
End If
Next i
'Notify completion
MsgBox "Export Complete", vbOKOnly, "Export Notification"
'Turn on Warnings
DoCmd.SetWarnings True
End Sub