PowerPoint 無像 Word/Excel 直接插入「總頁數」欄位,但可在投影片母版編輯頁碼區,手動加入「/總頁數」文字,配合投影片編號功能實現同等效果。
Sub UpdateTotalPages()
Dim sld As Slide
For Each sld In ActivePresentation.Slides
If Not sld.DisplayMasterShapes Then Exit Sub
For Each shp In sld.Master.Shapes
If shp.Type = msoPlaceholder And shp.PlaceholderFormat.Type = ppPlaceholderSlideNumber Then
shp.TextFrame.TextRange.Text = "<#>/<>" & ActivePresentation.Slides.Count
End If
Next
Next
End Sub
執行此巨集可自動將所有母版頁碼區更新為 `<#>/實際總頁數`,解決手動維護痛點。
母版編輯法零程式門檻,VBA 法一勞永逸,視簡報修改頻率選擇。