vba - Powerpoint VBA - .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
推荐阅读
- javascript - 如何使用来自javascript的XMLHttpRequest在flask中获取视图函数的返回值
- excel - VBA:代码使我的页面在运行时跳转
- c# - C# Process.Start 打开外部 EXE 文件的两个实例
- grafana - Grafana 重命名查询结果
- c - 在c中读取BMP文件时读取存储在头数组中的信息
- go - 有没有一种优雅的方法可以通过 cgo 将大字节切片或 io.Reader 传递给 c 而无需内存复制?
- python-3.x - 如何从 Python3 中的度数列表中找到元素的数量?
- java - 如何用流重写我的代码 - 甚至可以完成吗?
- aws-lambda - Slack Slash 命令和 API 网关集成
- c# - 使用 .net core 将存储过程的结果与返回对象映射