Option Explicit
Private Sub cmdProcess_Click()
Dim wdApp As Object 'Word.Application
Dim wdDoc As Object 'Word.Document
Dim wdSel As Object 'Word.Selection
Dim lngLastRow As Long, i As Long
lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
If lngLastRow < 5 Then Exit Sub
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Dim strPassengerName As String, strFlightName As String, strMessage1 As String, strMessage2 As String
For i = 5 To lngLastRow
Set wdDoc = wdApp.Documents.Add
strPassengerName = Range("A" & i).Value
strFlightName = Range("B" & i).Value
strMessage1 = "Hi #NAME#"
strMessage2 = "We are pleased to inform you that your flight #FLIGHT# has been confirmed."
wdDoc.Range.Font.Name = "Arial"
Set wdSel = wdApp.Selection
wdSel.TypeText Replace(strMessage1, "#NAME#", strPassengerName, 1, 1, vbBinaryCompare)
wdSel.TypeText vbCrLf
wdSel.TypeText Replace(strMessage2, "#FLIGHT#", strFlightName, 1, 1, vbBinaryCompare)
wdSel.TypeText vbCrLf
wdSel.TypeText "Regards,"
Set wdSel = Nothing
wdDoc.SaveAs Range("C" & i).Value & "\" & strPassengerName & "-" & strFlightName & ".docx"
wdDoc.Close
Next i
wdApp.Quit
Set wdSel = Nothing
Set wdApp = Nothing
End Sub