0

I was trying to use Workbook_SheetFollowHyperlink() to trigger a macro if the user clicks the hyperlink.

However, this Workbook_SheetFollowHyperlink macro is to be inserted on a sheet-level, not on the module level.

Is there any way that I can programmatically add this Workbook_SheetFollowHyperlink macro to every sheet? The reason is, I create these sheets on the fly using VBA, and the number of sheets and their names are not known in advance beforehand.

1 Answer 1

1

Workbook_SheetFollowHyperlink is defined in the ThisWorkbook class module. (At Worksheet level, it's Worksheet_FollowHyperlink)

So, you already have what you need: an Event that responds to following a Hyperlink on any sheet in the workbook.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. But is there a way that I could add codes programatically to the ThisWorkbook object?
You can modify the VBA at run time (using Microsoft Visual Basic for Applications Extensibility 5.3 in Tools>References.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.