我想应用布局到现有的幻灯片在ppt。下面的代码是创建新的边和应用布局。有没有人能帮帮我。我不想创建新幻灯片。我只想将布局应用到现有幻灯片。
Set ppt = CreateObject("PowerPoint.Application")
Set myPres = ppt.Presentations.Open(pptName)
For i = 1 To 10
Set slds = myPres.Slides
Set sld = slds.Add(myPres.Slides.Count + 1, ppLayoutBlank)
For Each oLayout In myPres.Designs("Office Theme").SlideMaster.CustomLayouts
If oLayout.Name = "Title and Content" Then
sld.CustomLayout = oLayout
Exit For
End If
Next
Next i
发布于 2021-01-27 15:15:33
Set ppt = CreateObject("PowerPoint.Application")
Set myPres = ppt.Presentations.Open(pptName)
'For i = 1 To 10
' Set slds = myPres.Slides
' Set sld = slds.Add(myPres.Slides.Count + 1, ppLayoutBlank)
For each sld in myPres.Slides
For Each oLayout In myPres.Designs("Office Theme").SlideMaster.CustomLayouts
If oLayout.Name = "Title and Content" Then
sld.CustomLayout = oLayout
Exit For
End If
Next
'Next i
https://stackoverflow.com/questions/65914707
复制