|
楼主 |
发表于 2023-10-31 12:12
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
知识点不够,没有解决。
- Sub TraversePptDelPicture()
- Dim Fso As FileSystemObject, oFile As File, oFolder As Folder
- Set Fso = New FileSystemObject
- Dim Img As WIA.ImageFile
- Set Img = New WIA.ImageFile
- Dim Rng As Range, Sht As Worksheet
- Set Rng = Selection
- Set Sht = Rng.Parent
- Dim PathName, PicName, Ll, Str
-
- PathName = ThisWorkbook.Path & "\Ppt\2023年10月31日-1.Pptm"
-
- Dim oScale
- Dim Pres As Presentation
- Set Pres = OpenPpt(PathName)
- Dim Sld As Slide, Shp 'As Shape
- For Each Sld In Pres.Slides
- With Sld.NotesPage
- Set Rng = Sht.Range(.Shapes(3).TextFrame.TextRange.Text)
- Str = .Shapes(2).TextFrame.TextRange.Text
- If Fso.FileExists(Str) = False Then
- Rng.Resize(, 1).Resize(, 12).ClearContents
- Sld.Delete
- End If
- End With
- If Fso.FileExists(Str) Then
- Set oFile = Fso.GetFile(Str)
- Set oFolder = oFile.ParentFolder
- End If
- Next Sld
- Debug.Print oFolder.Files.Count = Pres.Slides.Count, oFolder.Files.Count, Pres.Slides.Count
- Stop
- Stop
- End Sub
复制代码 |
|