手動插入百張圖片需數小時,VBA 巨集僅需秒數。前提:圖片檔名為連續編號(1.jpg、2.jpg...),存放於固定路徑。
C:\Pictures\1.jpg 至 100.jpg(對應投影片 1-100)Sub InsertPic()
Dim i As Integer
For i = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(i).Select
With ActiveWindow.Selection.SlideRange
.FollowMasterBackground = msoFalse
.Background.Fill.UserPicture "C:\Pictures\" & i & ".jpg"
End With
Next
End Sub
VBA 讓重複性大量操作自動化,是 PPT 進階使用者核心競爭力。