【发布时间】:2016-10-06 23:03:20
【问题描述】:
我正在编写一个简单的宏来更改字体并为幻灯片中的每张幻灯片添加徽标。
问题是每张幻灯片上的字体都在更新,但图像只粘贴在一张幻灯片上。 - 所以我最终在一张幻灯片上叠加了 30 张图片(不是我需要的每张幻灯片上的 1 张图片)
我有以下:
Sub InsertLogoOnEveryPage()
Dim sld As Slide
Dim shp As Shape
Dim sFontName As String
Dim oTop As Integer
' font:
sFontName = "Times"
For Each sld In ActivePresentation.Slides
Debug.Print sld.Name
'Insert logo.
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="PATH\Logo_RGB.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=60, Top:=oTop, _
Width:=330, Height:=330).Select
For Each shp In sld.Shapes
With shp
If .HasTextFrame Then
If .TextFrame.HasText Then
.TextFrame.TextRange.Font.Name = sFontName
End If
End If
End With
Next shp
oTop = oTop + 10
Next sld
End Sub
任何解决这个问题的帮助都很棒,谢谢!
【问题讨论】:
标签: vba powerpoint