Powerpoint VBA-未创建形状超链接

时间:2019-12-05 22:16:20

标签: vba powerpoint

我有以下代码可以从其他模块中调用:

Public Sub LinkToAddInfo(currentSlide As Long, boxName As String, addNumber As Long)

    Dim oShape As Shape
    Set oShape = ActivePresentation.Slides(currentSlide).Shapes.AddShape(msoShapeRoundedRectangle, 640, 470, 71, 27)

    With oShape
        .Fill.ForeColor.RGB = RGB(191, 191, 191)
        .Fill.Transparency = 0
        .Name = boxName

         With .ActionSettings(ppMouseClick)
            .Action = ppActionHyperlink
            .Hyperlink.SubAddress = ActivePresentation.Slides(addNumber).Name
        End With

    End With ' Shape itself

End Sub

这是为了创建链接到另一张幻灯片的形状。除With .ActionSettings(ppMouseClick)部分外,代码的每个部分都工作正常。

为什么不创建超链接?

1 个答案:

答案 0 :(得分:2)

只需替换.Hyperlink.SubAddress = ActivePresentation.Slides(addNumber).Name

.Hyperlink.SubAddress = addNumber

这是假设addNumber是您要超链接的幻灯片。