使用 Excel 中的 VBA 在 PowerPoint 中更改 SlideSize
Changing SlideSize in PowerPoint Using VBA in Excel
我正在编写 VBA 代码,将我众多的 excel 工作表转换为 powerpoint 演示文稿。代码工作正常,但我需要将我的 SlideSize 转换为 A4 格式以便打印。为了创建演示文稿,我使用了我公司的模板。当我从这个模板创建一个新的 PPT 时,它总是在 A4 中。当我的代码创建一个时,它在 4:3 中。
在 PageSetup 中更改 SlideSize 不起作用。
这是我的代码的摘录:
Dim oPP As Object
Dim oPPT As Object
Dim oPPTslide As Object
Set oPP = CreateObject("PowerPoint.Application")
oPP.Visible = True
Set oPPT = oPP.Presentations.Add
oPPT.ApplyTemplate {Template Name and Path}
oPPT.PageSetup.SlideSize = ppSlideSizeA4Paper
我总是得到一个错误PageSetup.SlideSize: 枚举值无效。
如果您使用后期绑定来自动化 PowerPoint,那么您将必须定义常量。
Const ppSlideSizeA4Paper = 3
我正在编写 VBA 代码,将我众多的 excel 工作表转换为 powerpoint 演示文稿。代码工作正常,但我需要将我的 SlideSize 转换为 A4 格式以便打印。为了创建演示文稿,我使用了我公司的模板。当我从这个模板创建一个新的 PPT 时,它总是在 A4 中。当我的代码创建一个时,它在 4:3 中。 在 PageSetup 中更改 SlideSize 不起作用。
这是我的代码的摘录:
Dim oPP As Object
Dim oPPT As Object
Dim oPPTslide As Object
Set oPP = CreateObject("PowerPoint.Application")
oPP.Visible = True
Set oPPT = oPP.Presentations.Add
oPPT.ApplyTemplate {Template Name and Path}
oPPT.PageSetup.SlideSize = ppSlideSizeA4Paper
我总是得到一个错误PageSetup.SlideSize: 枚举值无效。
如果您使用后期绑定来自动化 PowerPoint,那么您将必须定义常量。
Const ppSlideSizeA4Paper = 3