- word教程自学:右键不能新建office word怎么办
- pdf怎么转换成word:Word2013怎么取消启用实时预览的功能
- word做表格教程基本操作:Word插入艺术字方法
- word教程零基础教程免费:在WORD表格中引用AutoCAD的形位公差
word中的vba里面的RecordCount属性,其功能是返回一个 Long对象,word零基础教程,该对象代表数据源中记录的数字为只读。
语法如下:
expression.RecordCount
参数说明
expression 必需。该表达式返回一个MailMergeDataSource对象。
注意:
如果 Microsoft Word 不能确定数据源中记录的数字,RecordCount属性会返回值 -1。
以下内容是有关RecordCount的代码示例
On Error GoTo ErrorHandler
With ActiveDocument.MailMerge.DataSource
.ActiveRecord = wdFirstRecord
Do
If Len(.DataFields(6).Value) < 5 Then
.Included = False
.InvalidAddress = True
.InvalidComments = "The zip code for this record" & _
"is less than five digits. This record is" & _
"removed from the mail merge process."
End If
If .ActiveRecord <> .RecordCount Then
.ActiveRecord = wdNextRecord
End If
Loop Until .ActiveRecord = .RecordCount
ErrorHandler:
End With
上面的代码循环遍历数据源中的记录并验证邮政编码域(在本示例中是第六个域)是否少于五位,word零基础教程,如果少于五位,则从邮件合并中删除该记录。
如果要确保将定位代码添加到邮政编码中,word教程基础入门,可以将长度值从 5 改为 10。从而,如果邮政编码少于 10 位,就将其从邮件合并中删除。
上一篇:word文档教程全集:word之VBA RecordCount属性使用示例 下一篇:word文档转成ppt教程:在Word2010中如何启用quot;忽略全部大写的单词quot;
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。