Delphi 运行Word VBA 宏 删除软回车
Sub 整理网页()
'整理网页:删除软回车、删除空白段、使段落文字两端对齐
Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?^l"
.Replacement.Text = "^&^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^1^l"
.Replacement.Text = "^&^p"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^l"
.Replacement.Text = ""
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^s"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Paragraphs.Alignment = wdAlignParagraphJustify
End Sub
Delphi可以通过ole word的方式来运行宏:
WordDoc := WordApp.Documents.open(fileName:=fn, Revert:=true, Visible := True);
wordapp.Run( MacroName:='整理网页');
非常蹊跷的是,如果Visible := False,则word宏不能运行!
Delphi 运行Word VBA 宏 删除软回车的更多相关文章
- Word中批量替换软回车
在平时工作中,有时候需要拷贝一些截取自网页上的文字,当选中后拷贝到Word中时,有时候在每行的结尾出现如下的符号,,这给后期文字的整理带来了很多不便,在此记录从网上获取的解决方法,以免遗忘和便于查找. ...
- [Word]将word文件中的软回车符[↓]替换为硬回车符
Ctrl+H,替换对话框 搜索:^l 替换:^p 确定替换即可.
- Word 软回车和硬回车
网页上复制一大段内容,会发现很多向下的箭头,这种叫软回车,要如何批量替换成常见的硬回车呢? 工具/原料 word文档 方法/步骤 1 先认识这种向下的箭头,这种回车形式叫软回车,按shif ...
- word文档巧替换(空行替换、空格替换、软回车替换成硬回车)
一.空行替换 在日常工作中,我们经常从网上下载一些文字材料,往往因空行多使得页数居高不下.一般方法是:在“编辑”菜单中打开“查找和替换”对话框(或按ctrl+H),在“查找内容”中输入“^p^p”“替 ...
- 功能区按钮调用Excel、PowerPoint、Word中的VBA宏:RunMacro
功能区按钮调用Excel.PowerPoint.Word中的VBA宏:RunMacro 众所周知,Excel.PPT.Word文档或加载宏文件中可以写很多过程和函数,调试的过程中当然可以按F8或F5直 ...
- 利用VBA宏批量解决Word中图片大小、居中设置
需求:经常阅读网上的研报(没钱买排版漂亮的高质量研报),有些需要保存的复制下来到word里,图片很大都超出word的边界了,也没有居中,手工一张张调整不现实,上百页的研报,几十张图片. 解决方案:利用 ...
- Word 录制宏解决粘贴网络上文字格式错乱
本文将利用Word中的录制宏来解决 复制粘贴网络上文字格式错乱的问题. 本文宏代码取自 : 知乎 李文超,感谢他的提供. Technorati 标签: Word宏 格式修正 1 ...
- Delphi读取Word
Delphi读取Word现在关于往Word中写入数据的方法比较多,现在专门开个贴子,希望大家把自己读取Word内容的心得体会说一下,包括读取word文档中,有几个段落,如何读取第几个段落,读取有拼音的 ...
- 用Delphi进行word开发
使用以CreateOleObjects方式调用Word 实际上还是Ole,但是这种方式能够真正做到完全控制Word文件,能够使用Word的所有属性,包括自己编写的VBA宏代码.------------ ...
随机推荐
- Javascript属性constructor/prototype的底层原理
在Javascript语言中,constructor属性是专门为function而设计的,它存在于每个function的prototype属性中. 这个constructor保存了指向function ...
- 搭建SSH框架整合Struts2和Spring时,使用@Autowired注解无法自动注入
© 版权声明:本文为博主原创文章,转载请注明出处 1.问题描述: 搭建SSH框架,在进行Struts2和Spring整合时,使用Spring的@Autowired自动注入失败,运行报错java.lan ...
- 解决ubuntukylin 13.10安装wine时无法解决软件包依赖问题
在ubuntukylin 13.10中,无论是在软件中心安装wine还是通过apt-get install安装wine都会出现软件包依赖问题且无法解决. 问题重现 在软件中心安装wine报错例如以下: ...
- Junit内部解密之三: 单元测试用例运行的全过程
转自:http://blog.sina.com.cn/s/blog_6cf812be0100x8sb.html 我们以一个非常简单的TestCalculator类为例,只有一个测试方法: Public ...
- MapReduce源码分析之LocatedFileStatusFetcher
LocatedFileStatusFetcher是MapReduce中一个针对给定输入路径数组,使用配置的线程数目来获取数据块位置的实用类.它的主要作用就是利用多线程技术,每个线程对应一个任务,每个任 ...
- 使用Eclipse自带的Maven插件创建Web项目时报错:
问题描述: 使用Eclipse自带的Maven插件创建Web项目时报错: Could not resolve archetype org.apache.maven.archetypes:maven-a ...
- Android数据适配器(Adapter)优化:使用高效的ViewHolder
原文链接:http://stackvoid.com/using-adapter-in-efficiency-way/ 在使用Listview或GridView的时候,往往须要自己定义数据适配器.一般都 ...
- Tomcat startup.bat启动隐藏弹出的信息窗口
to make tomcat to use javaw.exe instead of java.exe using some startup parameter or environment vari ...
- 仿照ArrayList自己生成的MyList对象
现在需要自己生成一个list集合,基本雷同ArrayList,不使用API的List接口. 实现如下: MyList的代码: public class MyList<T> { privat ...
- 第一课 第一个nodejs程序
这就是我们的第一个程序了 在控制台会输出:hello 我们需要运行该文件 开始->运行 cmd 进入我们的程序目录 我的是D:/nodejs/hello.js 进入程序目录cd D:/nodej ...