The Computer Oracle

How do I stop Excel from checking the validity of hyperlinks before it opens them?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: The Builders

--

Chapters
00:00 How Do I Stop Excel From Checking The Validity Of Hyperlinks Before It Opens Them?
00:46 Accepted Answer Score 5
01:18 Answer 2 Score 0
02:09 Answer 3 Score 0
02:17 Thank you

--

Full question
https://superuser.com/questions/562598/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#microsoftexcel #microsoftoffice

#avk47



ACCEPTED ANSWER

Score 5


A registry setting can change this behavior and force Excel to simply launch URL's in the default browser. There could be security implications, so be sure to read the following article carefully and decide if it's the right thing for you to do.

http://support.microsoft.com/kb/218153#FixItForMeAlways

I ran the "Fix it for me" application after several unsuccessful attempts to manually make the registry edits.

Now my hyperlinks launch in the default browser, without the pre-check, regardless if it's clicked by the user, or programmatically launched in VBA.




ANSWER 2

Score 0


In excel 2003, the ForceShellExecute=1 regedit solution does not work. My workaround is calling the links directly from the shell using a macro. The below macro is right now creating 2 types of links from the current row depending on which column I click. This can of course be changed to check if there is a link in the cell you're selecting. Also selecting with right mouse button works in case there is an active link in the cell.

Option Explicit

Private Declare Function ShellExecute _
  Lib "shell32.dll" Alias "ShellExecuteA" ( _
  ByVal hWnd As Long, _
  ByVal Operation As String, _
  ByVal Filename As String, _
  Optional ByVal Parameters As String, _
  Optional ByVal Directory As String, _
  Optional ByVal WindowStyle As Long = vbMinimizedFocus _
  ) As Long

Public Sub OpenUrl(link As String)
    Dim lSuccess As Long
    lSuccess = ShellExecute(0, "Open", link)
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim c As Range: Set c = Selection
    If c.Count <> 1 Then Exit Sub
        
    Dim y As Integer: Let y = c.Row
    If y < 11 Then Exit Sub
    
    Dim name As String: Let name = Cells(y, 3).Value
    If name = "" Then Exit Sub
    
    Dim x As Integer: Let x = c.Column
    Dim link As String: Let link = ""
    If x = 10 Then Let link = "prefix of link type 1"
    If x = 11 Then Let link = "prefix of link type 2"
    If link = "" Then Exit Sub
    
    link = link & name
    OpenUrl link
End Sub



ANSWER 3

Score 0


For more people struggling: I made a small solution for this, it has also a hosted variant.