It helps when you supply all the required information and not drip feed it.
Yes the macro will do as you indicate because it looks for a string within the filename that matches the column 1. That string will be in all those examples that you quote. If the filenames are separated by spaces as you said earlier e.g.
Sealing Invoice ***XX1- Customer 740000.pdf
Then we can look instead at the number after the final space e.g.
Option Explicit
Sub Mail_Attachments()
Dim OutApp As Object
Dim OutMail As Object
Dim sAttach As String
Dim sPath As String
Dim iLastRow As Integer
Dim shtAddr As Worksheet
Dim xlSheet As Worksheet
Dim iRow As Long
Dim LastRow As Long
Dim vFname As Variant
Dim sFName As String
Set xlSheet = ActiveWorkbook.Sheets("Email Body")
xlSheet.Activate
LastRow = xlSheet.Range("A" & xlSheet.Rows.Count).End(-4162).Row
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
'LastRow = 3 'THIS LINE IS FOR TESTING ONLY!!!
For iRow = 2 To LastRow 'Ignore the header row
If LCase(xlSheet.Range("G" & iRow)) = "yes" Then
sPath = xlSheet.Range("D" & iRow)
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = xlSheet.Range("C" & iRow)
.Subject = xlSheet.Range("E" & iRow)
sAttach = Dir$(sPath & "*.pdf")
While Len(sAttach) <> 0
vFname = Split(sAttach, Chr(32)) 'Split the filename by spaces
sFName = vFname(UBound(vFname)) 'Look at the last item
If sFName = xlSheet.Range("A" & iRow) & ".pdf" Then 'check if the last item matches the cell value + the extension
.attachments.Add sPath & sAttach
End If
sAttach = Dir$()
DoEvents
Wend
.HTMLBody = "<HTML><BODY>Please find invoice " & sAttach & " attached" _
& "<BR>" & "</HTML></BODY>"
' .Send 'or use .Display
.Display
End With
End If
Next iRow
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set xlSheet = Nothing
Set shtAddr = Nothing
Set OutMail = Nothing
Set OutApp = Nothing
End Sub