|
楼主 |
发表于 2024-4-7 12:07
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
优化程序
- 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
复制代码 |
|