Powerpoint VBA - 未创建形状超链接
Powerpoint VBA - shape hyperlink not being created
我有以下代码,我可以从任何其他模块中调用它:
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
这是为了创建一个链接到另一张幻灯片的形状。除了 With .ActionSettings(ppMouseClick)
部分之外,代码的每个部分都工作得很好。
为什么没有创建超链接?
只需替换.Hyperlink.SubAddress = ActivePresentation.Slides(addNumber).Name
和.Hyperlink.SubAddress = addNumber
这是假设 addNumber
是您要超链接到的幻灯片。
我有以下代码,我可以从任何其他模块中调用它:
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
这是为了创建一个链接到另一张幻灯片的形状。除了 With .ActionSettings(ppMouseClick)
部分之外,代码的每个部分都工作得很好。
为什么没有创建超链接?
只需替换.Hyperlink.SubAddress = ActivePresentation.Slides(addNumber).Name
和.Hyperlink.SubAddress = addNumber
这是假设 addNumber
是您要超链接到的幻灯片。