(Solved) – Powerpoint VBA – Syntax error on .Tags.Add

(solved)-–-powerpoint-vba-–-syntax-error-on-tags.add

My code is as follows (tag building referencing this answer):

Public Sub LinkToAddInfo(currentSlide As Long, boxName As String, addDisplay As Long, addName 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
        .Tags.Add("Nametag",ActivePresentation.Slides(addNumber).Name)

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

    End With ' Square itself

End Sub

Everything is working fine, but the .Tags.Add("Nametag",ActivePresentation.Slides(addNumber).Name) line throws a syntax error. This is true even when I replace the latter part with a hardcoded string like "test".

Why is this?

Leave a Reply

Your email address will not be published. Required fields are marked *