Powerpoint VBA - 语法错误。Tags.Add

Powerpoint VBA - Syntax error on .Tags.Add

我的代码如下(标签构建引用):

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

一切正常,但 .Tags.Add("Nametag",ActivePresentation.Slides(addNumber).Name) 行抛出语法错误。即使我用像 "test".

这样的硬编码字符串替换后一部分也是如此

这是为什么?

已解决。只需要将其更改为:

.Tags.Add "Nametag", ActivePresentation.Slides(addNumber).Name