Syntax

expression.DataSource

expression A variable that represents an OfficeDataSourceObject object.

Example
The following example sets the name of the data source if the name is blank.

Visual Basic for Applications
Sub SetAndReturnDataSourceName() Dim appOffice As OfficeDataSourceObject Set appOffice = Application.OfficeDataSourceObject With appOffice .Open bstrConnect:="DRIVER=SQL Server;SERVER=ServerName;" & _ "UID=user;PWD=;DATABASE=Northwind", bstrTable:="Employees" If .DataSource = "" Then .DataSource = "Northwind" MsgBox .DataSource End If End With End Sub
data data source datasource datasource property ofv

See also: