Propiedad MailMergeDataSource.Included (Word)

True si se incluye un registro en una combinación de correspondencia. Boolean de lectura y escritura.

Sintaxis

expresión. Included

Expresión Expresión que devuelve un objeto "MailMergeDataSource".

Comentarios

Utilice el método SetAllIncludedFlags para incluir o excluir todos los registros de un origen de datos de combinación de correspondencia.

Ejemplo:

En este ejemplo se recorren los registros de un origen de datos de combinación de correspondencia y se comprueba si el campo de código postal (en este caso, el número de campo seis) contiene menos de cinco dígitos. Si un registro contiene un código postal de menos de cinco dígitos, se excluye de la combinación de correspondencia y la dirección se marca como no válida.

Sub CheckRecords() 
 
 Dim intCount As Integer 
 
 On Error Resume Next 
 
 With ActiveDocument.MailMerge.DataSource 
 
 'Set the active record equal to the first included record 
 ' in the data source 
 .ActiveRecord = wdFirstRecord 
 Do 
 intCount = intCount + 1 
 
 'Set the condition that field six must be greater than 
 'or equal to five 
 If Len(.DataFields(6).Value) < 5 Then 
 
 'Exclude the record if field six is less than five 
 .Included = False 
 
 'Mark the record as containing an invalid address field 
 .InvalidAddress = True 
 
 'Specify the comment attached to the record 
 'explaining why the record was excluded 
 'from the mail merge 
 .InvalidComments = "The ZIP Code for this record " & _ 
 "has fewer than five digits. It will be removed " _ 
 & "from the mail merge process." 
 
 End If 
 
 'Move the record to the next record in the data source 
 .ActiveRecord = wdNextRecord 
 
 'End the loop when the counter variable equals the 
 'number of records in the data source 
 Loop Until intCount = .RecordCount 
 End With 
 
End Sub

Consulte también

Objeto MailMergeDataSource

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.