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

OfficeDataSourceObject.ConnectString Property (Office)

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

Gets or sets a String that represents the connection to the specified mail merge data source. Read/write.


expression. ConnectString

expression A variable that represents an OfficeDataSourceObject object.


This example checks if the connection string contains the characters ODSOOutlook and displays a message accordingly.

Sub VerifyCorrectDataSource() 
 Dim appOffice As OfficeDataSourceObject 

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

 If InStr(appOffice.ConnectString, "ODSOOutlook") > 0 Then 
 MsgBox "Your Outlook address book is used as the data source." 
 MsgBox "Your Outlook address book is not used as the data source." 
 End If 

End Sub

See also


OfficeDataSourceObject Object

Other resources

OfficeDataSourceObject Object Members

© 2018 Microsoft