ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink events (https://www.excelbanter.com/excel-programming/274087-hyperlink-events.html)

Ignatius[_2_]

Hyperlink events
 
Two related issues.

Firstly is it possible to "trap" the followhyperlink event
at a sheet or workbook level when the hyperlink is derived
from a textbox (or any other shape for that matter).

Secondly is it possible to set up a workbook level
followhyperlink event for all textboxes on workbook. I
tried using a technique that works for controls on a
userform but I'm doing something wrong or (as the error
message suggests) shapes don't expose the appropriate
functionality. It doesn't necessarly need to be the
followhyperlink event, the click event would be good
enough.

Dave Peterson[_3_]

Hyperlink events
 
Maybe you could fudge something.

I added a bunch of textboxes from the drawing toolbar (not the controltoolbox
toolbar) and typed in my hyperlink addresses. But then I removed the hyperlink
itself--I just wanted the text.

Then I assigned each textbox this macro:

Option Explicit
Sub myTextBoxClick()

Dim myTB As TextBox
Set myTB = ActiveSheet.TextBoxes(Application.Caller)

ThisWorkbook.FollowHyperlink myTB.Text

End Sub

This is pretty restrictive, but it might give you some ideas.



Ignatius wrote:

Two related issues.

Firstly is it possible to "trap" the followhyperlink event
at a sheet or workbook level when the hyperlink is derived
from a textbox (or any other shape for that matter).

Secondly is it possible to set up a workbook level
followhyperlink event for all textboxes on workbook. I
tried using a technique that works for controls on a
userform but I'm doing something wrong or (as the error
message suggests) shapes don't expose the appropriate
functionality. It doesn't necessarly need to be the
followhyperlink event, the click event would be good
enough.


--

Dave Peterson



All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com