有没有一种方法可以开始在特定幻灯片上运行宏

时间:2020-04-03 05:46:30

标签: vba powerpoint

我有一个可以更改字体和字体大小的宏,但是我不需要它在第一张幻灯片上启动,如何编程使其在第二张幻灯片上首先启动? 另外,如何通过宏更改幻灯片的大小?

3 个答案:

答案 0 :(得分:1)

使用PowerPoint事件,可以捕获SlideShowNextSlide事件,然后检查SlideIndex属性以查找是否为2。如果是,请调用要运行的Sub。这是有关如何使用事件的教程,其中的链接也值得阅读:Make your VBA code in PowerPoint respond to events

此语句将更改幻灯片的大小:

import numpy as np
size = 200000
large_matrix = np.identity(size, dtype=uint8)

答案 1 :(得分:0)

If ActivePresentation.SlideShowWindow.View.Slide.SlideIndex = 2 Then
'change font and size
End If

这是一个If条件,仅当您在幻灯片编号2中时才能更改字体和大小。

答案 2 :(得分:0)

根据您的意图,其他答案可能是正确的。如果您想从幻灯片2 开始并继续直到放映结束,则类似以下内容:

Dim x as Long
Dim oSl as Slide
For x = 2 to ActivePresentation.Slides.Count
  Set oSl = ActivePresentation.Slides(x)
  With oSl
    ' Do whatever you need to do with the slide here
  End With
Next