@dbooth88, your pictured warning is actually generated by the HLINK.dll, not Excel/Office.
https://learn.microsoft.com/en-US/mi...erlink-warning
https://social.technet.microsoft.com...-from-hlinkdll
In the past, I tried various changes to Trust and Alert settings, and even a few registry hacks, to get rid of it - all to no avail. In the end, the only way I found to avoid that message was to bypass HLINK altogether by opening files using the ShellExecute API function, as demonstrated below:
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
Const SW_HIDE As Long = 0
Const SW_SHOWNORMAL As Long = 1
Const SW_SHOWMINIMIZED As Long = 2
Const SW_SHOWMAXIMIZED As Long = 3
Const SW_SHOW As Long = 5
Function Open_Link(ByVal Link As String) As Boolean
'Link can be a URL : "https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutea"
'OR a fully-specified file path : "C:\Users\YourUserName\Documents\YourFileName.pdf"
Open_Link = ShellExecute(Application.hwnd, "Open", Link, 0&, 0&, SW_SHOW) > 32& 'Greater than 32 = SUCCESS!
End Function
Sub MyButton_Click()
MyLink = "C:\Users\YourUserName\Documents\YourFileName.pdf"
If Not Open_Link(MyLink) Then MsgBox "File " & MyLink & " not found.", vbCritical
End Sub
This example defines the Open_Link function in a standard module to serve as an interface you can call from anywhere in your project. It takes a filename as input and passes it to ShellExecute, which attempts to open the file. If successful, Open_Link returns True; otherwise it returns False.
Note that you can also open URL's with ShellExecute, although you would need additional code to verify success.
And finally, HERE'S a similar thread that modifies hyperlinks to avoid the same warning in a similar fashion.
Bookmarks