在 PrintOptions 下添加范围并在变量中确定它
Adding ranges under PrintOptions and determining it in a variable
我可以添加一个范围,但无法添加多个范围并在变量中确定它:
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
是否可以在变量下确定上述范围?
谢谢。
ActivePresentation.PrintOptions.Ranges.Add
adds one range and it returns a PrintRange
object. It can't hold multiple ranges because it represents a single range. If you have multiple ranges, then you have multiple PrintRange
objects thus you can access them and use PrintRanges
collection.
PrintRanges object (PowerPoint)
A collection of all the PrintRange objects in the specified
presentation. Each PrintRange object represents a range of
consecutive slides or pages to be printed.
Example Use the Ranges property to return the PrintRanges
collection.
因此,当您添加多个范围时:
With ActivePresentation
With .PrintOptions
.RangeType = ppPrintSlideRange
With .Ranges
.ClearAll
.Add 1, 1
.Add 3, 3
End With
End With
End With
然后您就拥有了 ActivePresentation.PrintOptions.Ranges
collection 的所有这些范围。
For Each Range In ActivePresentation.PrintOptions.Ranges
Debug.Print TypeName(Range)
Next Range
更新
如果您想 ExportAsFixedFormat
导出特定的幻灯片,那么您可以 select 您想要导出哪些幻灯片并使用 ppPrintSelection
作为 RangeType
参数:
' Select slides 1 and 3
ActivePresentation.Slides.Range(Array(1, 3)).Select
' Export PDF with selected slides
ActivePresentation.ExportAsFixedFormat _
Path:=savePath, _
FixedFormatType:=ppFixedFormatTypePDF, _
RangeType:=ppPrintSelection
我可以添加一个范围,但无法添加多个范围并在变量中确定它:
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
是否可以在变量下确定上述范围?
谢谢。
ActivePresentation.PrintOptions.Ranges.Add
adds one range and it returns a PrintRange
object. It can't hold multiple ranges because it represents a single range. If you have multiple ranges, then you have multiple PrintRange
objects thus you can access them and use PrintRanges
collection.
PrintRanges object (PowerPoint)
A collection of all the PrintRange objects in the specified presentation. Each PrintRange object represents a range of consecutive slides or pages to be printed.
Example Use the Ranges property to return the PrintRanges collection.
因此,当您添加多个范围时:
With ActivePresentation
With .PrintOptions
.RangeType = ppPrintSlideRange
With .Ranges
.ClearAll
.Add 1, 1
.Add 3, 3
End With
End With
End With
然后您就拥有了 ActivePresentation.PrintOptions.Ranges
collection 的所有这些范围。
For Each Range In ActivePresentation.PrintOptions.Ranges
Debug.Print TypeName(Range)
Next Range
更新
如果您想 ExportAsFixedFormat
导出特定的幻灯片,那么您可以 select 您想要导出哪些幻灯片并使用 ppPrintSelection
作为 RangeType
参数:
' Select slides 1 and 3
ActivePresentation.Slides.Range(Array(1, 3)).Select
' Export PDF with selected slides
ActivePresentation.ExportAsFixedFormat _
Path:=savePath, _
FixedFormatType:=ppFixedFormatTypePDF, _
RangeType:=ppPrintSelection