Thev
Thev

Reputation: 1125

Powerpoint VBA - shape hyperlink not being created

I have the following code which I can call from within any other module:

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

This is meant to create a shape which links to another slide. Every part of the code works perfectly fine, except for the With .ActionSettings(ppMouseClick) part.

Why is the Hyperlink not being created?

Upvotes: 1

Views: 99

Answers (1)

PuravTheGreat
PuravTheGreat

Reputation: 136

Just replace .Hyperlink.SubAddress = ActivePresentation.Slides(addNumber).Name

with .Hyperlink.SubAddress = addNumber

This is assuming that addNumber is the slide you would like to hyperlink to.

Upvotes: 2

Related Questions