![](/img/trans.png)
[英]Creating Word Application using Excel VBA: Run-time error '429': ActiveX component can't create object
[英]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.