如何使用 vba 在 powerpoint 中应用特定布局? [英] How to apply particular layout in powerpoint using vba?

查看:33
本文介绍了如何使用 vba 在 powerpoint 中应用特定布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目.我制作了一个自定义主题,其中包括一张母版幻灯片和可能的布局.所以基本上我想将特定的布局应用于特定的幻灯片.那么有没有办法通过编程来做到这一点.喜欢:

I am working on one project. In that I made one custom theme which includes one master slide and may layouts. so basically i want to apply particular layout to specific slides. So is there any way to do it by programmatically. like :

activepresentation.Slides(1).Layout="layoutname"

activepresentation.Slides(1).Layout="layoutname"

我知道上面的代码是错误的,但我想要这样的东西通过它的名字来调用特定的布局.为了您的信息,我的布局名称是没有客户徽标的标题".

I know above code is wrong but i want something like this to call particular layout by its name. for your information my layout name is "Title without Client Logo".

谢谢

推荐答案

ActivePresentation.Slides(1).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(x)

ActivePresentation.Slides(1).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(x)

其中 x 是表示您的自定义布局的布局集合的索引.

where x is the index into the layouts collection that represents your custom layout.

与 PPT OM 中的大多数其他此类集合不同,这个集合似乎无法接受索引或名称.它必须是一个索引.

Unlike most other such collections in the PPT OM, this one seems unable to accept either an index or a name. It must be an index.

如果您需要处理名称,请编写一个函数来遍历 CustomLayouts 集合,直到找到您要查找的名称并返回索引.

If you need to work with the name, write a function that iterates through the CustomLayouts collection until it finds the name you're after and returns the index.

这篇关于如何使用 vba 在 powerpoint 中应用特定布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆