Table of contents
TOC
Collapse the table of content
Expand the table of content

ODSOColumn Object (Office)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Represents a field in a data source. The ODSOColumn object is a member of the ODSOColumns collection.

Remarks

The ODSOColumns collection includes all the data fields in a mail merge data source (for example, Name, Address, and City).

You cannot add fields to the ODSOColumns collection. All data fields in a data source are automatically included in the ODSOColumns collection.

Use Columns( index ), where index is the data field name or index number, to return a single ODSOColumn object. The index number represents the position of the data field in the mail merge data source.

Example

This example retrieves the name and value of the first field of the first record in the data source attached to the active publication.

Sub GetDataFromSource() 

 Dim appOffice As OfficeDataSourceObject 

 Set appOffice = Application.OfficeDataSourceObject 
 appOffice.Open bstrConnect:="DRIVER=SQL Server;SERVER=ServerName;" & _ 
 "UID=user;PWD=;DATABASE=Northwind", bstrTable:="Employees" 

 With appOffice.Columns 
 MsgBox "Field Name: " & .Item(1).Name & vbLf & _ 
 "Value: " & .Item(1).Value 
 End With 
End Sub

Properties

Name
Application
Creator
Index
Name
Parent
Value

See also

Other resources

Object Model Reference

© 2017 Microsoft