我希望创建一个 VBA 函数来更改形状的颜色(如果附加了超链接)。
不确定这是否有帮助:
ActiveSheet.Shapes.Hyperlink.Fill.ForeColor.RGB = vbBlue
...
"IF(Shape contains hyperlink)
Change shape color to blue
Else
No change"
最佳答案
更改形状的颜色
Sub ChangeShapesColor()
Dim ws As Worksheet: Set ws = ActiveSheet ' improve!
Application.ScreenUpdating = False
Dim shp As Shape
Dim hl As Hyperlink
For Each shp In ws.Shapes
On Error Resume Next
Set hl = shp.Hyperlink
On Error GoTo 0
'Debug.Print shp.Name, Not hl Is Nothing
If Not hl Is Nothing Then
shp.Fill.ForeColor.RGB = vbYellow ' RGB(255, 255, 0)
Set hl = Nothing
End If
Next shp
Application.ScreenUpdating = True
MsgBox "Shapes' color changed.", vbInformation
End Sub
关于excel - 如果有超链接,则可以更改形状颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72088100/