Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
69 lines (43 loc) · 1.93 KB

odsocolumn-object-office.md

File metadata and controls

69 lines (43 loc) · 1.93 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date
ODSOColumn Object (Office)
vbaof11.chm233000
vbaof11.chm233000
office
Office.ODSOColumn
f8fe41bd-c9bd-fb5b-8ca7-27940c9c0996
06/08/2017

ODSOColumn Object (Office)

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