none
Stop Excel from following specific hyperlinks RRS feed

  • Question

  • Hi All,

    I am attempting to create an Excel workbook add-in using VSTO for Excel 2003+. In it, when the user clicks on a hyperlink, and the hyperlink points to a file on the local machine, I want to stop the file from opening up on the native application (which is the default process) and show some details regarding the file on a custom action pane.

    I've gotten the action pane to display the file details, but am stuck on how to stop/cancel the hyperlink follow action. The Application.SheetFollowHyperlink action seems to fire after the file has already opened and I couldn't find resources that seem to tackle this issue.

    I would be extremely grateful any help provided.

    Cheers!

    Friday, February 6, 2015 6:39 AM

Answers

  • Don't use real hyperlinks. Format the cell to look like a hyperlink, but use the worksheet's selection change event to do what you want: either follow the hyperlink, or show values.

    This macro will remove all hyperlinks (except for formulas):

    Sub RemoveHLs()
    ActiveSheet.Hyperlinks.Delete
    End Sub

    Friday, February 6, 2015 4:56 PM

All replies

  • Don't use real hyperlinks. Format the cell to look like a hyperlink, but use the worksheet's selection change event to do what you want: either follow the hyperlink, or show values.

    This macro will remove all hyperlinks (except for formulas):

    Sub RemoveHLs()
    ActiveSheet.Hyperlinks.Delete
    End Sub

    Friday, February 6, 2015 4:56 PM
  • Hi Bernie!

    Thanks for the advice, much appreciated!

    Cheers!

    Monday, February 9, 2015 10:26 PM