20170709pptVBA递归删除LOGO图片与文字
Public Sub StartRecursionFolder()
Dim Pre As Presentation
Dim FolderPath As String
Dim pp As String
Dim id As String Dim oFileDialog As FileDialog
Set oFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
'Set Pre = Application.ActivePresentation
With oFileDialog
.AllowMultiSelect = False
'.InitialFileName = Pre.Path & "\"
If .Show = 0 Then Exit Sub
End With
FolderPath = oFileDialog.SelectedItems(1) & "\"
'递归处理
RecursionFolder FolderPath
'MsgBox "批处理完成"
End Sub
Public Sub PresentationHandle(ByVal FilePath As String)
Application.DisplayAlerts = ppAlertsNone
Dim Pre As Presentation
Dim mst As Master
Dim sld As Slide
Dim shp As Shape
Debug.Print FilePath
Set Pre = Application.Presentations.Open(FilePath)
'******************************母版的处理**********************
Dim dsg As Design
Debug.Print "模板个数"; Pre.Designs.Count For Each dsg In Pre.Designs Set mst = dsg.SlideMaster
For Each shp In mst.Shapes
'删除条件
Debug.Print shp.Width & "/" & shp.Height; " "; BetweenSize(shp.Width, 145, 160) And BetweenSize(shp.Height, 30, 55)
If BetweenSize(shp.Width, 145, 160) And BetweenSize(shp.Height, 30, 55) Then
shp.Delete
End If
Next shp If dsg.HasTitleMaster Then
Set mst = dsg.TitleMaster
For Each shp In mst.Shapes
'删除条件
Debug.Print shp.Width & "/" & shp.Height; " "; BetweenSize(shp.Width, 145, 160) And BetweenSize(shp.Height, 30, 55)
If BetweenSize(shp.Width, 145, 160) And BetweenSize(shp.Height, 30, 55) Then
shp.Delete
End If
Next shp
End If Next dsg For Each sld In Pre.Slides
For Each shp In sld.Shapes
'删除条件
If BetweenSize(shp.Width, 145, 160) And BetweenSize(shp.Height, 30, 55) Then
shp.Delete
End If
Next shp
Next sld DeleteShapsInPresentation Pre Pre.Save Pre.Close Set Pre = Nothing
Set mst = Nothing
Set sld = Nothing Application.DisplayAlerts = ppAlertsAll
End Sub
Private Function BetweenSize(ByVal Size As Double, ByVal MinSize As Double, ByVal MaxSize As Double) As Boolean
If Size >= MinSize And Size <= MaxSize Then
BetweenSize = True
Else
BetweenSize = False
End If
End Function
Public Sub RecursionFolder(ByVal FolderPath As String) '递归文件夹
'声明对象
Dim Fso As Object
Dim MainFolder As Object
Dim OneFolder As Object
Dim OneFile As Object
'实例化对象
Set Fso = CreateObject("Scripting.FileSystemObject")
Set MainFolder = Fso.GetFolder(FolderPath)
'对文件执行操作
For Each OneFile In MainFolder.Files
If OneFile.Name Like "*.ppt*" Then
'具体要做的事情
PresentationHandle OneFile.Path
End If
Next
'递归
For Each OneFolder In MainFolder.SubFolders
RecursionFolder OneFolder.Path
Next
'释放对象
Set Fso = Nothing
Set MainFolder = Nothing
End Sub Private Sub DeleteShapsInPresentation(ByVal Pre As Object)
Dim sld As Slide
Dim shp As Shape
Dim Txt As String
For Each sld In Pre.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame = msoTrue Then
If shp.TextFrame.HasText Then
Txt = shp.TextFrame.TextRange.Text
If Txt Like "*更多免费资料下载请进*" Then
shp.Delete
End If
End If
End If
Next
Next
For Each shp In Pre.SlideMaster.Shapes
If shp.HasTextFrame = msoTrue Then
If shp.TextFrame.HasText Then
Txt = shp.TextFrame.TextRange.Text
If Txt Like "*更多免费资料下载请进*" Then
shp.Delete
End If
End If
End If
Next End Sub
20170709pptVBA递归删除LOGO图片与文字的更多相关文章
- ASP.NET(C#)图片加文字、图片水印,神啊,看看吧
ASP.NET(C#)图片加文字.图片水印 一.图片上加文字: //using System.Drawing; //using System.IO; //using System.Drawing.Im ...
- ios图片添加文字或者水印
在项目中,我们会对图片做一些处理,但是我们要记住,一般在客户端做图片处理的数量不宜太多,因为受设备性能的限制,如果批量的处理图片,将会带来交互体验性上的一些问题.首先让我们来看看在图片上添加文字的方法 ...
- iOS开发富文本制作 图片和文字/NSMutableParagraphStyle/NSMutableAttributedString
/NSMutableParagraphStyle/NSMutableAttributedString 组合使 NSString * titlestr=@"日产GT-R"; NSMu ...
- CSS控制图片和文字在同一行显示且对齐的3种方法
CSS控制图片和文字在同一行显示且对齐的3种方法 在 HTML 代码中,有时会需要在文字旁边加上一个图标. 默认情况,是图片置顶对齐,文字置底对齐,所以通常图片高,文字低,不能水平居中对齐. 常见方法 ...
- markdown 使用示例,包含常用的标题、图片、文字样式、代码块、链接等
ps:博客园markdown不能自动生成列表,更好的阅读体验可访问我的个人博客http://www.isspark.com/archives/Markdown%E7%A4%BA%E4%BE%8B # ...
- python dict clear只能删除一层,不能够递归删除。
void PyDict_Clear(PyObject *op) { dictobject *mp; dictentry *ep, *table; int table_is_malloced; Py_s ...
- 鼠标滑过图片变暗文字链接滑出jQuery特效
效果体验:http://hovertree.com/texiao/jquery/7.htm HTML文件代码: <!DOCTYPE html> <html xmlns="h ...
- iOS开发小技巧--即时通讯项目:使用富文本在UILabel中显示图片和文字;使用富文本占位显示图片
Label借助富文本显示图片 1.即时通讯项目中语音消息UI的实现,样式如图: 借助富文本在UILabel中显示图片和文字 // 1.创建一个可变的富文本 NSMutableAttributedStr ...
- 【File】递归删除文件夹中子级文件/夹,并删除文件夹
今天有这样一个需求,需要删除某一个文件夹,但是文件夹中还有子级的文件 或者还可能会有文件夹在里面,所以就需要使用一个简单的递归才能将文件夹删除成功,包括文件夹中的子级文件/夹.!!! 其实很简单,就一 ...
随机推荐
- python 文件不存在时才能写入,读写模式xt
想向一个文件中写入数据,但是前提必须是这个文件在文件系统上不存在.也就是不允许覆盖已存在的文件内容. 可以在open() 函数中使用x 模式来代替w 模式的方法来解决这个问题.比如: >> ...
- Linux基础命令---gunzip
gunzip 解压缩被gzip压缩过的文件.此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.SUSE.openSUSE.Fedora. 1.语法 gunzip [-ac ...
- Linux服务器配置---安装vsftpd
安装vsftpd 大多数Linux系统都使用vsftpd,因此这里我们也安装vsftpd 1.安装vsftpd [root@localhost phpMyAdmin]# yum install -y ...
- 设置(更改)Mysql 自增ID的起始值
SELECT * FROM segwords WHERE id>790511 DELETE FROM segwords WHERE id>790511 #下面这句是设置的 ALTER TA ...
- 使用基于 PHP 的开源软件 YOURLS 搭建短链接地址服务
使用基于 PHP 的开源软件 YOURLS搭建 系统配置 php7.1+mysql5.7+nginx 下载源代码 git clone https://github.com/YOURLS/YOURLS. ...
- Spring IOC 源码分析
Spring 最重要的概念是 IOC 和 AOP,本篇文章其实就是要带领大家来分析下 Spring 的 IOC 容器.既然大家平时都要用到 Spring,怎么可以不好好了解 Spring 呢?阅读本文 ...
- c/c++的typedef/using类型别名
久而久之,发现c/c++的typedef给类型自定义别名的语法糖就保证设计的一致性而言,确实是个相当不错的特性,跟oracle pl/sql的rowtype或type一样,可惜java.mysql均不 ...
- 20145315何佳蕾《网络对抗》MSF基础应用
20145315何佳蕾<网络对抗>MSF基础应用 实验过程记录 (1)一个主动攻击,ms08_067; 1.打开msfconsole 2.use exploit/windows/smb/m ...
- linq——group by
多列排序&&聚合函数 var result = from i in (from uh in db.UserHistories ...
- 2、Python快速入门(0529)
要素7:输入/输出 1.python解释器提供了3种标准文件对象,分别为标准输入.标准输出和标准错误,它们在sys模块中分别以sys.stdin.sys.stdout和sys.stderr形式提供: ...