忽略标点符号、匹配前缀和后缀、清除突出显示

上传人:xiao****1972 文档编号:84316999 上传时间:2019-03-03 格式:DOCX 页数:3 大小:26.60KB
返回 下载 相关 举报
忽略标点符号、匹配前缀和后缀、清除突出显示_第1页
第1页 / 共3页
忽略标点符号、匹配前缀和后缀、清除突出显示_第2页
第2页 / 共3页
忽略标点符号、匹配前缀和后缀、清除突出显示_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《忽略标点符号、匹配前缀和后缀、清除突出显示》由会员分享,可在线阅读,更多相关《忽略标点符号、匹配前缀和后缀、清除突出显示(3页珍藏版)》请在金锄头文库上搜索。

1、 e800,国内最具活力的IT门户网站。http:/【e800编译】此示例演示Microsoft Word 2010中Find对象的一些功能,诸如忽略标点符号,忽略空格,匹配前缀和后缀,以及清除突出显示效果。此代码段是Office 2010的101项VBA代码示例中的一部分。与其它示例一样,这些将可以直接写入您的代码中。每块示例代码包含约5至50行的代码,分别演示了一个独特的功能或功能集,在VBA或VB以及C中(在Visual Studio 2010中创建)。每个示例之中都会包含代码以及相应注释,这样您就可以直接运行获取预期的结果,或者是根据代码注释提示来调整环境,运行示例代码。Microso

2、ft Office 2010提供了你所需要的工具来创建功能强大的应用程序。Microsoft Visual Basic Application(VBA)代码示例可以帮助你创建自己的应用程序,以执行特定功能或者以此为出发点实现更为复杂的功能。实例代码以下是在Word 2007中Find对象的一些新的功能:- IgnorePunct- IgnoreSpace- MatchPrefix- MatchSuffix- ClearHitHighlight- HitHighlight在一个新文档键入以下文本,然后按Enter键:= rand(5,5)这会在当前文档中插入各包含5个句子的5个段落。然后在VBA

3、编辑器中,复制这段代码到ThisDocument类中。按F8单步执行代码。并列放置VBA和Word窗口,这样你就可以查看单步代码的动作。Sub DemoFind() Set up a search, in the random text, for tab MostDim fnd As FindSet fnd = Content.Findfnd.Text = tab Most Ignore punctuation and white space. In the document, the text appears as tab. Most. This will still find a matc

4、h.fnd.IgnorePunct = Truefnd.IgnoreSpace = True Highlight the found text.fnd.HitHighlight fnd.Text, vbYellow, vbRed Now clear the highlighting. This is only meaningful if you are single-stepping through the code.fnd.ClearHitHighlight Match the text th only when it appears at the beginning of a word:f

5、nd.MatchPrefix = Truefnd.Text = thfnd.HitHighlight fnd.Text, vbYellow, vbRed Now clear the highlighting. This is only meaningful if you are single-stepping through the code.fnd.ClearHitHighlight Match the text th only when it appears at the end of a word:fnd.MatchPrefix = Falsefnd.MatchSuffix = Truefnd.Text = thfnd.HitHighlight fnd.Text, vbYellow, vbRed Now clear the highlighting. This is only meaningful if you are single-stepping through the code.fnd.ClearHitHighlightEnd Sub

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号