04 Export - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki
Export method
Exports to a workbook which can be used as a data source. Returns True if successful, otherwise False.
Applies to
| TableData | ArrData | RsetData | Xdata | XShared |
|---|---|---|---|---|
| ✓ | ✓ | ✓ |
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | Name of the worksheet to be created from this data (you can reference the data source in SQL as [Name$]). |
| Field | ParamArray | Field names or numbers to export (omit to export all fields). |
Sometimes SQL would be a convenient tool for manipulating data in workbooks. However it not recommended to connect directly to the active workbook with ADODB, and attempting to do so produces file locking issues. Also the data may not be in the right format. The Export method provides a solution to this problem, by first exporting the data to an external workbook to which it is possible to connect.
When Exporting from a TableData object, to ensure text fields are correctly interpreted, first use the TextFields method.
Each time Export is run, a new worksheet is created in the same external workbook.