|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
人工删除目录下的文件,回收站有删除文件。
oFile.Delete True,垃圾回收站为空。
If Fso.FileExists(PathName) Then
'Debug.Print PathName
Set oFile = Fso.GetFile(PathName)
oFile.Delete True
End If
- Function ReadSldDelExcelRow(oFile As File, Slds As Slides, Rng As Range)
-
- Dim Sld As Slide
- Dim oRng As Range
- Dim Sht As Worksheet
- Set Sht = Rng.Parent
- For Each Sld In Slds
- If Rng = Sld.Name Then
- Exit Function
- End If
- Next Sld
- ''
- Set oRng = Rng(, 0).Resize(, 24)
- oRng.Select
- oFile.Delete True
- oRng.Delete
- End Function
- ''
- Sub TraverseSlddelExcelRow()
- Dim Fso As FileSystemObject, oFile As File
- Set Fso = New FileSystemObject
- Dim Sht As Worksheet
- Dim Rng As Range, oRng As Range
- Set Rng = Selection
- Set Sht = Rng.Parent
- Set Rng = Sht.Cells(25, 1).CurrentRegion
- Debug.Print Rng.Address
- Dim Pres As Presentation
- Dim Sld As Slide, Slds As Slides
- Dim PathName, ii, jj
- PathName = ThisWorkbook.Path & "" & Sht.Name & ".Pptm"
- Set Pres = OpenPpt(PathName)
- Set Slds = Pres.Slides
- '''
- For ii = 1 To Rng.Rows.Count
- Debug.Print Rng(ii, 1).Address, Rng(ii, 2)
- PathName = ThisWorkbook.Path & "" & Sht.Name & "" & Rng(ii, 2)
- ''Debug.Print PathName
- If Fso.FileExists(PathName) Then
- 'Debug.Print PathName
- Set oFile = Fso.GetFile(PathName)
- ReadSldDelExcelRow oFile, Slds, Rng(ii, 2)
- End If
- Next ii
- End Sub
复制代码
|
-
|