使用部分文档

当您打开包含大尺寸内容的演示文稿时,PowerPoint 可能会将文档作为部分文档在部件中提供。 这使你可以快速打开、编辑和协作处理文档,而较大的媒体部件 (例如视频) 继续在后台加载。 同样,由于媒体与文档的其余部分分开处理,因此在协作会话期间插入媒体时,协作更加顺畅。

由于某些内容最初可以延迟,因此在加载延迟的内容之前无法执行某些操作。 此外,还有一些操作,例如另存为、导出到视频等。在下载所有延迟的内容之前,它才起作用。 如果启动其中一项操作,PowerPoint 将显示通知下载进度的 UI,但编程操作无法实现。 如果以编程方式尝试调用 API 以在内容仍在下载时执行操作,它将失败。

Run-time error '-2147188128 (80048260)':
<object> (unknown member) : This method isn't supported until the presentation is fully downloaded. Visit this URL for more information: https://go.microsoft.com/fwlink/?linkid=2172228

了解完全下载的状态

若要了解演示文稿是否以编程方式完全下载,可以在调用任何受影响的 API 之前查询 Presentation.IsFullyDownloaded 属性。

If ActivePresentation.IsFullyDownloaded Then
    MsgBox "Presentation download is complete."
Else
    MsgBox "PowerPoint is still downloading the presentation."
End If

错误处理

还可以添加一些错误处理来捕获失败,并在演示文稿完全下载后重试操作。 如果错误值为 -21471881280x80048260,则操作失败,因为演示文稿未完全下载。 使用 Err.Number 作为键来标识这些失败,如以下示例所示。

Sub TestCopySlide()
    On Error GoTo eh    
    ActivePresentation.Slides(1).Copy    
    Exit Sub
eh:
    If Err.Number = -2147188128 Then
        MsgBox "Cannot copy because the presentation is not fully downloaded."
    Else
        MsgBox "Failure is due to a reason other than incomplete download: " & Err.Description.
    End If
    Debug.Print Err.Number, Err.Description
End Sub

受影响的 API

下面是受影响的 OM API 调用的列表,这些调用可能会返回错误代码:

名称
Presentation.Export
Presentation.ExportAsFixedFormat
Presentation.ExportAsFixedFormat2
Presentation.SaveAs
Presentation.SaveCopyAs
Presentation.SaveCopyAs2
Presentation.Password
Presentation.WritePassword
Selection.Copy
Selection.Cut
Shape.Copy
Shape.Cut
ShapeRange.Cut
ShapeRange.Copy
Shapes.Paste
Shapes.PasteSpecial
Slide.Copy
Slide.Cut
Slide.Export
SlideRange.Copy
SlideRange.Cut
SlideRange.Export
幻灯片.粘贴
CustomLayouts.Paste
View.Paste
View.PasteSpecial
MediaFormat.Resample
MediaFormat.ResampleFromProfile
Player.Play

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。