This should do what you are looking for. You will need to place the PDFs in a trusted location otherwise you will get a popup every time it tries to open one. There may be a workaround besides trusted locations but I am not aware of it (and is generally ill-advised to use such things).
You will also need to change Hwnd = FindWindow(vbNullString, filename & " - Foxit Reader")
to whatever PDF reader you are using, I have Foxit so that's what it is currently.
Thanks to Siddharth Rout for the closing of the PDF.
Option Explicit
'Thanks to Siddharth Rout for this chunk
#If VBA7 Then
Private Declare PtrSafe Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassname As String, ByVal lpWindowName As String) As Long
#Else
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassname As String, ByVal lpWindowName As String) As Long
#End If
Private Const WM_CLOSE = &H10
Sub t()
Dim Tcell As Range
Dim link As String
Dim lastrow As Long
Dim iter As Long
With Sheet4
lastrow = .Cells(.Rows.Count, 5).End(xlUp).Row
For iter = 2 To lastrow
Set Tcell = .Cells(iter, 5)
On Error GoTo errhandler
ThisWorkbook.FollowHyperlink Tcell.value
On Error GoTo 0
'Thanks to Siddharth Rout for this chunk
Dim Hwnd As Long
Dim filename As String
filename = Split(Tcell.value, "\")(UBound(Split(Tcell.value, "\")))
'~~> Find the window of the pdf file
Hwnd = FindWindow(vbNullString, filename & " - Foxit Reader")
'~~> Close the file
PostMessage Hwnd, WM_CLOSE, 0, ByVal 0&
continueiter:
Next iter
End With
Exit Sub
errhandler:
Select Case Err.Number
Case -2147221014
Tcell.Interior.Color = vbRed
GoTo continueiter
Case Else
MsgBox "Unhandled Error: " & Err.Number & chr(10) & Err.Description
End Select
End Sub