代码之家  ›  专栏  ›  技术社区  ›  A Cohen

VBA-创建、编辑和超链接形状

  •  2
  • A Cohen  · 技术社区  · 7 年前

    For s = 7 To Sheets.Count
        With Sheets(s)
            Dim GoToSummary As Shape
            Set GoToSummary = .Shapes.AddShape(msoShapeRoundedRectangle, 400, 153 + 12.75 * 2, 300, 50)
    
            .Shapes(GoToSummary).TextFrame.Characters.Text = "Go Back To Summary"
        End With
    Next s  
    

    我知道这是不对的,这就是为什么我要伸出援手,因为我找不到任何类似我的情况。

    1 回复  |  直到 7 年前
        1
  •  2
  •   barvobot    7 年前

    Sub test()
    Dim GoToSummary As Shape
    
    For s = 7 To Sheets.Count
        Set GoToSummary = Sheets(s).Shapes.AddShape(msoShapeRoundedRectangle, 400, 153 + 12.75 * 2, 300, 50)
        GoToSummary.TextFrame.Characters.Text = "Go Back To Summary"
        Sheets(s).Hyperlinks.Add Anchor:=GoToSummary, Address:="", SubAddress:="Summary!A1"
    Next s
    
    End Sub
    
    • Dim GoToSummary 环路外
    • GoToSummary .Shapes(GoToSummary)
    • 还添加了超链接