我在图表中有表示数据流中进程的形状;根据形状和形状名称中的文本,形状被超链接到位于另一个选项卡中的过程定义(例如,名为“Control ##”的形状带有文本“ABC”链接到定义 ABC 过程的选项卡)。如果我将形状中的文本更改为“XYZ”,是否有办法自动更新该形状中的超链接 - 即我希望超链接然后转到“XYZ”定义?我尝试了 SheetFollowHyperlink 事件过程,但似乎没有任何反应。我到目前为止的代码如下:
Sub AssignHyperlink()
Dim CallerShapeName As String
CallerShapeName = Application.Caller
With ActiveSheet
Dim CallerShape As Shape
Set CallerShape = .Shapes(CallerShapeName)
Dim RowVar As Integer
Err.Number = 0
On Error Resume Next
If InStr(CallerShapeName, "Control") = 1 Then
RowVar = Application.WorksheetFunction _
.Match(.Range("C2").Value & CallerShape.TextFrame2.TextRange.Text, _
Sheets("Control Point Log").Range("A1:A700"), 0)
If (Err.Number = 1004) Then
MsgBox "No match found for this shape text in the Control Point Log"
Exit Sub
End If
On Error GoTo 0
.Hyperlinks.Add Anchor:=CallerShape, _
Address:=ActiveWorkbook.Name & "#" & "'Control Point Log'!$C$" & RowVar
Else
RowVar = Application.WorksheetFunction _
.Match(.Range("C2").Value & CallerShape.TextFrame2.TextRange.Text, _
Sheets("Data Flow Glossary").Range("A1:A700"), 0)
If (Err.Number = 1004) Then
MsgBox "No match found for this shape text in the Data Flow Glossary"
Exit Sub
End If
On Error GoTo 0
.Hyperlinks.Add Anchor:=CallerShape, _
Address:=ActiveWorkbook.Name & "#" & "'Data Flow Glossary'!$C$" & RowVar
End If
End With
End Sub