craig.penny
Well-known Member
- Joined
- May 8, 2009
- Messages
- 656
I use this code to add shapes with hyperlinks
Which I mostly got from another thread on this site. The problem I'm having is that when using the link on the shape it no longer triggers this Event
So Sub SausageLinks never gets called. My question is this, is there a way I can detect that the link has been followed from the shape?
As always, I truly welcome and appreciate any and all ideas!
Code:
Public Sub AddHyperlinks2()
Dim TargetRng As Range: Set TargetRng = Application.InputBox(prompt:="Select Range", Type:=8)
Dim shp As Shape
With ActiveSheet
Set shp = .Shapes.AddShape(msoShapeRoundedRectangle, 100, 100, 10, 10)
With shp
.Fill.ForeColor.RGB = RGB(204, 255, 204)
.Line.ForeColor.RGB = RGB(0, 0, 0)
' .TextFrame.Characters.Text = strRowName
.TextFrame.HorizontalAlignment = xlHAlignLeft
.TextFrame.Characters.Font.ColorIndex = xlAutomatic
.TextFrame.Characters.Font.FontStyle = "Bold"
.Locked = True
End With
.Hyperlinks.Add Anchor:=shp, Address:="", SubAddress:="'" & CStr(TargetRng.Parent.Name) & "'!" & CStr(TargetRng.Address), ScreenTip:="Link"
End With
End Sub
Which I mostly got from another thread on this site. The problem I'm having is that when using the link on the shape it no longer triggers this Event
Code:
Public Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink) 'Sh is caller
If InStr(1, CStr(Target.Address), "www") > 0 Then Exit Sub
Call SausageLinks("WBFollow", Sh, Target)
End Sub
So Sub SausageLinks never gets called. My question is this, is there a way I can detect that the link has been followed from the shape?
As always, I truly welcome and appreciate any and all ideas!