对声明为文档的 xDoc 的引用在 PowerPoint VBA 中生成 "user defined type not defined"

Reference to xDoc, declared as Document, generates "user defined type not defined" in PowerPoint VBA

我想要在 PowerPoint 中:单击命令按钮后,将带有附件(同一个 PowerPoint 演示文稿)的电子邮件发送到特定的电子邮件地址。

我是基于互联网使用的,但我认为 xDoc 可能有问题?

当我点击按钮时,它显示“未定义用户定义类型”,然后 Private Sub CommandButton1_Click() 变为黄色。

Private Sub CommandButton1_Click()
    Dim xOutlookObj As Object
    Dim xEmail As Object
    Dim xDoc As Document
    Application.ScreenUpdating = False
    Set xOutlookObj = CreateObject("Outlook.Application")
    Set xEmail = xOutlookObj.CreateItem(olMailItem)
    Set xDoc = ActiveDocument
    xDoc.Save
    With xEmail
        .Subject = "Lorem ipsum"
        .Body = "Lorem ipsum"
        .To = "xyz@xyz.xyz"
        .Importance = olImportanceNormal
        .Attachments.Add xDoc.FullName
        .Display
    End With
    Set xDoc = Nothing
    Set xEmail = Nothing
    Set xOutlookObj = Nothing
    Application.ScreenUpdating = True
End Sub
Dim xDoc As Document

这是一个 Word VBA 语句。尝试:

Dim xPres As Presentation

然后更改代码中的所有 xDoc 引用。即:

Set xPres = ActivePresentation