Thank you for your response,If you are sure that workbook is from trusted source as message says,
go to excel options, trust center and enable macro security option.
Every time you are not sure in the new opened workbook disable this option.
I did, but the same issue!Do it for Active X settings also.
What code are you using to open the PDF files?
Sub FindRequest()
Dim i As String
i = Cells(ActiveCell.Row, 1).Text
ThisWorkbook.FollowHyperlink "D:\LAB\Tests\2020\Requests\E05-" + i + ".pdf"
End Sub
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_HIDE As Long = 0&
Const SW_SHOW As Long = 5&
Sub FindRequest()
Dim i As String
i = Cells(ActiveCell.Row, 1).Text
ShellExecute Application.hwnd, "Open", "D:\LAB\Tests\2020\Requests\E05-" + i + ".pdf", 0&, 0&, SW_SHOW
End Sub
I got thisTry this instead:
Code:Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Const SW_HIDE As Long = 0& Const SW_SHOW As Long = 5& Sub FindRequest() Dim i As String i = Cells(ActiveCell.Row, 1).Text ShellExecute Application.hwnd, "Open", "D:\LAB\Tests\2020\Requests\E05-" + i + ".pdf", 0&, 0&, SW_SHOW End Sub
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr