|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
一、插入类模块,命名为“clsEvent”,在类模块中添加如下代码
- Public WithEvents pptApp As Application
- Private Sub pptApp_SlideSelectionChanged(ByVal SldRange As SlideRange)
- Call AddPage
- End Sub
复制代码 二、插入模块,添加如下代码
- Dim X As New clsEvent
- Sub AddPage()
- Set X.pptApp = Application
- Dim Width As Single, Height As Single, shp As Shape, n As Long, i As Long
- With ActivePresentation
- Width = .PageSetup.SlideWidth '幻灯片的宽度
- Height = .PageSetup.SlideHeight '幻灯片的高度
- n = .Slides.Count '计算幻灯片的总数
- On Error GoTo 0
- For i = 1 To n '从第1页开始添加
- On Error Resume Next
- .Slides(i).Shapes("PageShape").Delete
- Set shp = .Slides(i).Shapes.AddTextbox(msoTextOrientationHorizontal, Width - 150, Height - 70, 30, 48) '水平文本框,左边距,顶边距,高度,宽度
- With shp
- .Name = "PageShape"
- .TextFrame.WordWrap = msoFalse
- .TextFrame.TextRange.Text = "第" & i & "页" '页码
- .TextFrame.TextRange.Font.NameAscii = "黑体"
- .TextFrame.TextRange.Font.NameFarEast = "黑体"
- .TextFrame.TextRange.Font.Size = 54 '字号
- .TextFrame.TextRange.Font.Color.RGB = RGB(Red:=255, Green:=0, Blue:=0)
- End With
- Next
- End With
- End Sub
复制代码 三、每次打开PPT都先运行一遍“AddPage”
|
评分
-
1
查看全部评分
-
|