I'm trying to detect clicked hyperlinks in Excel. The Application.SheetFollowHyperlink Event claims that it will be called "when you click any hyperlink in Microsoft Excel."
However, although it does fire when a cell contains a url like www.google.com
, it does not when the cell contains =HYPERLINK("http://www.google.com", "google")
.
How do I detect clicks to the second type of hyperlink?
For example, a simple excel add in:
Public Class ThisAddIn
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
End Sub
Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
End Sub
Private Sub Application_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Microsoft.Office.Interop.Excel.Hyperlink) Handles Application.SheetFollowHyperlink
MsgBox("Hyperlink Clicked")
End Sub
A message box containing "Hyperlink Clicked" will appear when you click a cell containing www.google.com
but not a cell containing =HYPERLINK("http://www.google.com", "google")
.