簡體   English   中英

VBA錯誤429“ ActiveX無法創建應用程序對象”

[英]VBA Error 429 'ActiveX can't create application object'

嗨,Guyz,我正在使用Powerpoint編寫這些代碼行,但出現錯誤429

錯誤

請幫助。

Option Explicit

Sub ListSlideInformationInExcel()
Dim i, j As Integer

Cells(1, 1).Value = "slide number"
Cells(1, 2).Value = "Name"
Cells(1, 3).Value = "No. of shapes"

Dim appPower As Object
Set appPower = CreateObject("Powerpoint.Application")
Dim pPres As PowerPoint.Presentation

appPower.Visible = True

appPower.Presentations.Open "C:\Users\SUMIT\Downloads\Slide Show Demo.ppt"

For i = 1 To pPres.Slides.Count
    j = 2
    Range("A" & j).Value = ActiveWindow.Selection.SlideRange.SlideIndex
    Range("B" & j).Value = ActivePresentation.Slides(i).Name
    Range("C" & j).Value = ActivePresentation.Slides(i).Shapes.Count
    j = j + 1
Next
End Sub

這可能無法完全解決您的問題,但假設安裝了Power Point,則您應該能夠始終使用后期綁定引用,如下所示。

Option Explicit
Sub ListSlideInformationInExcel()
    Dim i As Long, j As Long
    With ActiveSheet
        .Cells(1, 1).Value = "slide number"
        .Cells(1, 2).Value = "Name"
        .Cells(1, 3).Value = "No. of shapes"

        Dim appPower As Object, pPres As Object
        Set appPower = CreateObject("Powerpoint.Application")
        appPower.Visible = True    
        Set pPres = appPower.Presentations.Open("C:\Users\SUMIT\Downloads\Slide Show Demo.ppt")
        'Other stuff
    End With  
End Sub

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM