嗨,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
答案 0 :(得分:0)
这可能无法完全解决您的问题,但假设安装了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