|
楼主 |
发表于 2024-4-7 12:07
|
显示全部楼层
优化程序
- Sub ll()
- Dim WpsApp As Application
- 'Set WpsApp = GetObject(, "Kwpp.Application")
-
- Dim Pres As Presentation
-
-
- Set Pres = OpenPpt("C:\Z.ppt")
- With Pres
- Debug.Print .Name, .Slides.Count, .FullName
- End With
- Stop
- Dim Wk As Workbook, Sht As Worksheet
- Set Wk = Application.Workbooks(1)
- Set Sht = Wk.Sheets(1)
- Debug.Print Wk.Name, Sht.Name
- End Sub
- Function OpenPpt(PptName As String)
- Dim WpsApp As PowerPoint.Application
- 'Set WpsApp = GetObject(, "Kwpp.Application")
- Set WpsApp = New PowerPoint.Application
-
-
- Dim PresS As Presentations
- Set PresS = WpsApp.Presentations
- Dim Pres As Presentation
- For Each Pres In PresS
- Debug.Print Pres.FullName
- If UCase(Pres.FullName) = UCase(PptName) Then
- Set OpenPpt = Pres
- Exit Function
- End If
- Next Pres
- Set OpenPpt = PresS.Open(PptName)
-
- End Function
复制代码 |
|