Accessing Data Sources


Types of DataSource


ActiveDocument.MailMerge.DataSource.Type = wdMailMergeDataSource.wdNoMergeInfo 


Opening a Linked DataSource

When a mailmerge document is opened you will be asked if you want to link it to its data source.
If the datasource cannot be accessed remotely by another means then it can be accessed directly using the datasource of the document

ActiveDocument.MailMerge.DataSource 

List of Field Names

This list can be accessed using the FieldNames collection. This collection starts from 1.

ActiveDocument.MailMerge.DataSource.FieldNames 

Dim iFieldCount As Integer 
For iFieldCount = 1 to ActiveDocument.MailMerge.DataSource.FieldNames.Count

End If


List of Data Fields

This list can be accessed using the FieldNames collection. This collection starts from 1.

ActiveDocument.MailMerge.DataSource.DataFields 

Dim iFieldCount As Integer 
For iFieldCount = 1 to ActiveDocument.MailMerge.DataSource.DataFields.Count

End If


ActiveDocument.MailMerge.DataSource.ActiveRecord 
ActiveDocument.MailMerge.DataSource.FindRecord
ActiveDocument.MailMerge.DataSource.FirstRecord
ActiveDocument.MailMerge.DataSource.Included
ActiveDocument.MailMerge.DataSource.InvalidAddress
ActiveDocument.MailMerge.DataSource.InvalidComment
ActiveDocument.MailMerge.DataSource.LastRecord
ActiveDocument.MailMerge.DataSource.MappedDataFields
ActiveDocument.MailMerge.DataSource.RecordCount



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext