我需要在演示文稿中为每张幻灯片添加一系列图像,从0到1400,步长为56(0,56,112等),然后使背景透明
到目前为止,我有:
Sub InsertImage()
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="C:\Folder\Image0.bmp", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=25, Top:=90, _
Width:=265, Height:=398.5).Select
End Sub
Sub MakeTransparent()
With ActiveWindow.Selection.ShapeRange
.PictureFormat.TransparentBackground = msoTrue
.PictureFormat.TransparencyColor = RGB(41, 41, 241)
.Fill.Visible = msoFalse
End With
End Sub
每个人都会单独做,但这并不比逐个做到这一点快?
非常感谢任何帮助!
谢谢,
劳伦
答案 0 :(得分:2)
假设你想从幻灯片1开始并且你已经在演示文稿中有足够的幻灯片来包含所有图像,请尝试这样的事情(总空气代码):
Sub InsertImages()
Dim lImageNumber as Long
Dim lSlideNumber as Long
Dim oSh as Shape
lSlideNumber = 1 ' Slide counter
For lImageNumber = 0 to 1400 Step 56
Set oSh = ActivePresentation.Slides(lSlideNumber).Shapes.AddPicture( _
FileName:="C:\Folder\Image" & cstr(lImageNumber) & ".bmp", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=25, Top:=90, _
Width:=265, Height:=398.5)
lSlideNumber = lSlideNumber + 1
With oSh
.PictureFormat.TransparentBackground = msoTrue
.PictureFormat.TransparencyColor = RGB(41, 41, 241)
.Fill.Visible = msoFalse
End With
Next
End Sub