Hyperlink to a subroutine

Is it possible to get an hyperlink to run a subroutine I managed to get the hyperlink to go to the subroutine but it doesn't actually run it.

Answer this question

Hyperlink to a subroutine

  • Philip Jaques

    Thanks for your prompt reply.

    I am trying in Excel. Here is the code I want to execute from the hyperlink. It is in a module called mdlMain.

    Option Explicit

    Public Sub FinishIt()
        Application.DisplayAlerts = True
        ThisWorkbook.Save
        ThisWorkbook.Saved = True
        Application.Quit
    End Sub

    The hyperlink is Link to: Existing File or Web Page, Current folder and the Address is: #FinishIt

    When the hyperlink is clicked the system opens the VBA code and moves the cursor into the start of the line Application.DisplayAlerts = True as if in edit mode, not debug or anything like that.





  • Waseem Aslam

    It is possible to hyperlink to code from within MS Excel.

    Try this:::

    Open up your VBA editor and locate the "Microsoft Excel Objects" folder. Double click the SHEET object where the hyperlink is located.

    You should see an empty editor area with the words "Option Explicit" at the top. Now, at the top of the editor, left click the drop-down menu item that says "(General)." Then select the only other option located here which is "Worksheet."

    Now select the "FollowHyperlink" procedure located in the other drop-down box located to the immediate right of the object box.

    Place the code you would like to run here then close the VBA Editor.

    Now, when you click the hyperlink in your worksheet, the code will run.

    Brice Richard

  • Marcel Meijer

    can you please provide some additional details

    what program are you trying to do this from (Word, Excel, )
    do you have an example of the code that you've tried for the engineer to look at

    thanks!
    -brenda (ISV Buddy Team)

  • St3veM

    Thanks to both of you. As soon as I saw the words 'Follow Hyperlink' the penny dropped!

    Thanks again

  • fly_eye

    thanks for jumping in to answer this question Brice!

    -brenda (ISV Buddy Team)

  • Hyperlink to a subroutine