DataRecordset.CommandString Property (Visio)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Gets or sets the command string used to query the data source to create a data recordset or refresh an existing one. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

expression .CommandString

expression An expression that returns a DataRecordset object.

Return Value


The command string of a data recordset specifies the database table or Microsoft Excel worksheet and the columns within the table or worksheet that contain the data you want to query. The command string is also passed to the DataRecordset.Refresh method when the data in the data recordset is refreshed.

Setting the CommandString property to a new value has no effect on data already in the data recordset. To update the data in a data recordset using a new CommandString setting, call the Refresh method.

The CommandString property does not apply to data recordsets created by using the AddFromXML method.

The following sample command string directs Visio to retrieve all data from an Excel worksheet named Sheet1: "SELECT * FROM [Sheet1$]".