【发布时间】:2018-02-25 02:47:07
【问题描述】:
我需要一个 PowerPoint 幻灯片中的按钮,当我单击它时,它将 1) 运行宏和 2) 超链接到同一演示文稿中的另一张幻灯片。
我只能看到一种方法来做一个或另一个,而不是同时做。
我的宏代码是:
Sub question1_real()
Dim oSh As Shape
Dim oSl As Slide
Dim lScore As Long
' By doing it this way it's easy to change to a different slide if you
' need to later for some reason:
Set oSl = ActivePresentation.Slides(18)
' Change this if your shape is named something else:
Set oSh = oSl.Shapes("TextBox 2")
With oSh
' Make sure it's not blank to start with:
If Len(.TextFrame.TextRange.Text) = 0 Then
.TextFrame.TextRange.Text = "1"
End If
lScore = CLng(.TextFrame.TextRange.Text)
lScore = lScore + 1
.TextFrame.TextRange.Text = CStr(lScore)
End With
End Sub
我的 VBA 技能为零。上面的代码是从某人那里借来的。我使用 PowerPoint 中的“插入操作”选项使其工作。
【问题讨论】:
标签: vba powerpoint