【问题标题】:Powerpoint VBA - Syntax error on .Tags.AddPowerpoint VBA - .Tags.Add 上的语法错误
【发布时间】:2019-12-06 00:35:38
【问题描述】:

我的代码如下(标签构建引用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

一切正常,但.Tags.Add("Nametag",ActivePresentation.Slides(addNumber).Name) 行引发语法错误。即使我将后半部分替换为像"test" 这样的硬编码字符串也是如此。

这是为什么?

【问题讨论】:

    标签: vba powerpoint


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多