'Suppressing Window Security Warning Message

I am looking for way to check if files exist in a SharePoint location. I am using a function that performs this action but a message box titled: Windows Security Warning, with the message "This pages is accessing information that is not under its control. This poses a security risk. Do you want to continue?"

Here is the function I am using:

Public Function SP_File_Exists (URLString as String) as Boolean
    Dim oHttPRequst as Object
    
    if Len(Trim(URLString)) =0 Then 
    SP_File_Exists = False
    Exit Function

    Set oHttpRequest = CreateObject("MSXML2.XMLHTTP.6.0")
With oHttpRequest
   .Open "GET", URLString, False
   .Send
End With

If oHttpRequest.Status = 200 Or Left(oHttpRequest.Status, 1) = 3 Then  ' '300 to accommodate redirects
    SPFile_Exists = True
Else
    SPFile_Exists = False
End If
   
End Function

Is there a way to suppress the message? I have tried using DisplayAlerts property and it doesn't work. I am hopeful that someone has conquered this problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source