Saves the specified PivotTable list to a file and optionally opens it in Microsoft Excel.
expression.Export(Filename, Action)
expression An expression that returns a PivotTable object.
Filename Optional String. Specifies the file name of the saved file. If you do not specify this argument, a temporary file is created in the user's temporaryfolder (the location of the temporary folder varies by operating system).
Action PivotExportActionEnum . Specifies what happens after the PivotTable list is saved to a file. If you do not specify this argument, the PivotTable list is opened in Excel. If Excel is not installed on the user's machine, an alert is displayed.
PivotExportActionEnum can be one of these PivotExportActionEnum constants. |
plExportActionNone |
plExportActionOpenInExcel default |
Export method as it applies to the Spreadsheet object.
expression.Export(Filename, Action, Format)
expression An expression that returns a Spreadsheet object.
Filename Optional String. Specifies the file name of the saved file. If you do not specify this argument, a temporary file is created in the user's temporary folder (the location of the temporary folder varies by operating system). You must specify this argument if the Action argument is set to ssExportActionNone.
Action Optional SheetExportActionEnum . Specifies whether or not the worksheet is saved to a file. If you do not specify this argument, the worksheet is opened in Microsoft Excel. If Excel is not installed on the user's machine, an alert is displayed.
SheetExportActionEnum can be one of these SheetExportActionEnum constants. |
ssExportActionNone |
ssExportActionOpenInExcel default |
Format Optional SheetExportFormat . Specifies the format to use when exporting the spreadsheet.
SheetExportActionEnum can be one of these SheetExportActionEnum constants. |
ssExportAsAppropriate default |
ssExportHTML
ssExportXMLSpreadsheet |
Example
As it applies to the Spreadsheet object.
This example exports the active worksheet to the specified file.
Sub ExportSpreadsheet()
Dim ssConstants
Set ssConstants = Spreadsheet1.Constants
Spreadsheet1.Export "ssheet1.htm", ssConstants.ssExportActionNone, _
ssConstants.ssExportXMLSpreadsheet
End Sub