用Access打开PPT演示文档示例

新知榜官方账号

2023-12-02 02:49:13

用Access打开PPT演示文档示例

本文介绍了使用Access打开PPT演示文档的方法。

问题描述:

能使用ACCESS打开PPT演示文档吗?如何操作?

解决方法:

使用Application对象(PowerPoint),即可解决。具体代码如下:

使用通用函数:

Function OpenPPT(sFileAsString, Optional bRunAsSlideShow As Boolean)'Designed by Daniel Pineault
Dim oPPT As Object

On Error Resume Next
Set oPPT = GetObject("PowerPoint.Application")

If Err.Number <> 0 Then
    Err.Clear
    Set oPPT = CreateObject("PowerPoint.Application")
End If

On Error GoTo Error_Handler

oPPT.Visible = True
oPPT.Presentations.Open(sFile) '打开对应的PPT演示文档

If bRunAsSlideShow Then
    oPPT.ActivePresentation.SlideShowSettings.Run
End If

Error_Handler_Exit:
    On Error Resume Next
    Set oPPT = Nothing
    Exit Function

Error_Handler:
    MsgBox "The following error has occurred." & vbCrLf & vbCrLf & _
           "Error Number: " & Err.Number & vbCrLf & _
           "Error Source: OpenPPT" & vbCrLf & _
           "Error Description: " & Err.Description, _
           vbCritical, "An Error has Occurred!"
    Resume Error_Handler_Exit
End Function

或者直接打开:

Private Sub Command0_Click()
    Dim oPPT As Object
    Set oPPT = CreateObject("PowerPoint.Application")
    oPPT.Visible = True
    oPPT.Presentations.Open "C:\Users\ZhiQiang.Li\Desktop\Arduino\程序设计基础PPT\IO口的高级应用.pptx"
End Sub

演示:

示例下载:

点击这里下载示例。

本页网址:https://www.xinzhibang.net/article_detail-21727.html

寻求报道,请 点击这里 微信扫码咨询

关键词

Access PPT 演示文档

分享至微信: 微信扫码阅读

相关工具

相关文章