Is this something like you want?
Option Explicit
#If VBA7 And Win64 Then
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr
#Else
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
#End If
Const WM_CLOSE = &H10
Sub SavePdfs()
Dim linkfile As Hyperlink
Dim savelocation As String
Dim PdfFile As String
savelocation = "C:\yourfolder\"
Application.ScreenUpdating = False
For Each linkfile In ThisWorkbook.Sheets("Sheet1").Hyperlinks
ActiveWorkbook.FollowHyperlink linkfile.Address
PdfFile = savelocation & linkfile.Range.Offset(0, 1).Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Close_Adobe_Reader
Next
Application.ScreenUpdating = True
End Sub
Sub Close_Adobe_Reader()
Dim strClassName As String
Dim hwnd As Variant
strClassName = "AcrobatSDIWindow"
hwnd = FindWindow(strClassName, vbNullString)
If hwnd Then
SendMessage hwnd, WM_CLOSE, 0, ByVal 0&
Else
MsgBox "Adobe is not running !"
End If
End Sub
Bookmarks