Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 在PrintOptions下添加范围并在变量中确定_Vba_Powerpoint - Fatal编程技术网

Vba 在PrintOptions下添加范围并在变量中确定

Vba 在PrintOptions下添加范围并在变量中确定,vba,powerpoint,Vba,Powerpoint,我可以添加一个范围,但无法添加多个范围并在变量中确定它: Set PR = ActivePresentation.PrintOptions.Ranges.Add(1, 1) 是否可以在上面添加更多范围 我尝试了以下方法,但无法将其设置为等于PR With ActivePresentation With .PrintOptions .RangeType = ppPrintSlideRange With .Ranges .ClearA

我可以添加一个范围,但无法添加多个范围并在变量中确定它:

Set PR = ActivePresentation.PrintOptions.Ranges.Add(1, 1)
是否可以在上面添加更多范围

我尝试了以下方法,但无法将其设置为等于
PR

With ActivePresentation
    With .PrintOptions
    .RangeType = ppPrintSlideRange
            With .Ranges
            .ClearAll
            .Add 1, 1
            .Add 3, 3
            End With
    End With
    .PrintOut
End With
是否可以在变量下确定上述范围

谢谢。

添加一个范围并返回一个对象。它不能包含多个范围,因为它代表一个范围。如果您有多个范围,那么您有多个
PrintRange
对象,因此您可以访问它们并使用集合

指定对象中所有对象的集合 演示每个PrintRange对象表示一个 要打印的连续幻灯片或页面

示例使用属性返回打印范围 收藏

因此,添加多个范围时:

使用ActivePresentation
使用。打印选项
.RangeType=ppPrintSlideRange
带。范围
克利尔先生
.加1,1
.加3,3
以
以
以
然后将所有这些范围添加到集合中

ActivePresentation.PrintOptions.Ranges中每个范围的

调试.打印类型名称(范围)
下一个范围
更新

如果要导出特定幻灯片,则可以选择要导出的幻灯片,并使用
ppPrintSelection
for
RangeType
参数:

”选择幻灯片1和3
ActivePresentation.Slides.Range(数组(1,3))。选择
'导出带有选定幻灯片的PDF
ActivePresentation.ExportAsFixedFormat_
路径:=保存路径_
FixedFormatType:=ppFixedFormatTypePDF_
RangeType:=ppPrintSelection

如何在
ActivePresentation.ExportAsFixedFormat
中提及上述内容。我能够更早地使用
PR
。在这种情况下我该怎么办?@KusaShaha您可以选择要导出的幻灯片,然后使用
ppPrintSelection
进行
RangeType
。检查我的最新答案。