VBA Hyperlink.Follow for Word Document Error Microsoft Word Security Notice

I have created a macro to get hyperlink text and address whether it’s internal or external in document and help to open the link to check the content of the link.

However, I’m encounter an issue where some link show popup as “Microsoft Word Security Notice this location might be unsafe.” In this case I couldn’t find anything to bypass or surpass this popup. Other than that, when I click Yes/No or OK in the popup, i will receive debug error Command Failed at ObjHyperlink.Follow.

Is there any way we can disable this kind of popup or bypass them using VBA? I know in excel we can use Application.DisplayAlerts = False but seems like I can’t make it work using this in Word.

Here is my current script.

Sub Hyperlinks_Ori_Bookmark_Testing()
   Dim doc As Object
   Dim objDoc As Object
   Dim objHyperlink As Object
   Dim hyperlinkAddress As String
   Dim hyperlinkedText As String
   Dim i As Integer
   Dim field As Object
   Dim bmName As String
   Dim bm As Bookmark
   Dim isBroken As Boolean
   Dim brokenLinks As String
   Dim shape As Object
   Dim shapeHyperlink As Object
    Dim FILEURL As String
   
      FILEURL = InputBox("Please enter the URL of the Word file on SharePoint:", "Select SharePoint File")
   If FILEURL = "" Then
       Exit Sub
   End If
   
   Dim desktopURL As String
   desktopURL = "ms-word:ofe|u|" & FILEURL
   On Error Resume Next
   ThisWorkbook.FollowHyperlink Address:=desktopURL
   
   Application.Wait Now + TimeValue("0:00:10")
   
 If Err.Number <> 0 Then
   MsgBox "Unable to open the file. Error: " & Err.Description & ". Please check the URL and try again.", vbCritical
   Err.Clear
Else
   ' Get the Word application object
   Set objWord = GetObject(, "Word.Application")
   If objWord Is Nothing Then
       MsgBox "Word application is not running or is not installed."
       Exit Sub
   End If
   
   ' Set the active document to objDoc
   Set objDoc = objWord.ActiveDocument
End If
On Error GoTo 0
   
   i = 3
   With objDoc
       ' Check regular hyperlinks
       For Each objHyperlink In .Hyperlinks
           hyperlinkedText = objHyperlink.Range.Text
           Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("A" & i).Value = hyperlinkedText
           If objHyperlink.Address <> "" Or objHyperlink.SubAddress <> "" Then
               If objHyperlink.SubAddress <> "" Then
                   hyperlinkAddress = objHyperlink.SubAddress
                   Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("B" & i).Value = hyperlinkAddress
                   Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("C" & i).Value = "Internal"
                   On Error Resume Next
                   objHyperlink.Follow
                   If Err.Number <> 0 Then
                       Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("D" & i).Value = "Link not OK!"
                       Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("A" & i & ":D" & i).Font.Color = RGB(255, 0, 0)
                       Err.Clear
                   Else
                       Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("D" & i).Value = "Link OK!"
                   End If
                   On Error GoTo 0
               Else
                   hyperlinkAddress = objHyperlink.Address
                   Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("B" & i).Value = hyperlinkAddress
                   Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("C" & i).Value = "External"
                   objHyperlink.Follow
                    SelectionInterface.Show
                    If SelectionInterface.Tag = "LinkOK" Then
                        Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("D" & i).Value = "Link OK!"
                    ElseIf SelectionInterface.Tag = "LinkNotOK" Then
                        Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("D" & i).Value = "Link not OK!"
                        Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("A" & i & ":D" & i).Font.Color = RGB(255, 0, 0)
                    ElseIf SelectionInterface.Tag = "NoAccess" Then
                        Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("D" & i).Value = "No Access!"
                        Workbooks("Document Hyperlink Checker.xlsm").Sheets("Automation").Range("A" & i & ":D" & i).Font.Color = RGB(255, 0, 0)
                    End If
               End If
           End If
           i = i + 1
       Next objHyperlink

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật