QueryTable.SourceDataFile property (Excel)

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 (such as Access), the SourceDataFile property contains a fully qualified path to the source data file. It's set to Null for server-based data sources (such as SQL Server). The SourceDataFile property is set to Null if the Connection property is changed programmatically.

If you import data by 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 by 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.

Use the QueryTable property of the ListObject to access the SourceDataFile property.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.