QueryTable.SourceDataFile Property

Excel Developer Reference

Returns or sets a String value that indicates the source data file for a query table.

Syntax

expression.SourceDataFile

expression   A variable that represents a QueryTable object.

Remarks

For file-based data sources (e.g. Access), the SourceDataFile property contains a fully qualified path to the source data file. It is set to Null for server-based data sources (e.g. SQL Server). The SourceDataFile property is set to Null if the Connection property is changed programmatically.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

You can use the QueryTable property of the ListObject to access the SourceDataFile property.

See Also