ChartSheet.SaveAs Method
Saves changes to the Microsoft.Office.Tools.Excel.ChartSheet in a different file.
Namespace: Microsoft.Office.Tools.Excel
Assemblies: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Sub SaveAs ( _
Filename As String, _
FileFormat As Object, _
Password As Object, _
WriteResPassword As Object, _
ReadOnlyRecommended As Object, _
CreateBackup As Object, _
AddToMru As Object, _
TextCodepage As Object, _
TextVisualLayout As Object, _
Local As Object _
)
void SaveAs(
string Filename,
Object FileFormat,
Object Password,
Object WriteResPassword,
Object ReadOnlyRecommended,
Object CreateBackup,
Object AddToMru,
Object TextCodepage,
Object TextVisualLayout,
Object Local
)
Parameters
Filename
Type: System.StringThe name of the file to be saved. You can include a full path; if you do not, Microsoft Office Excel saves the file in the current folder.
FileFormat
Type: System.ObjectThe file format to use when you save the file. For a list of valid choices, see the FileFormat property. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.
Password
Type: System.ObjectA case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.
WriteResPassword
Type: System.ObjectThe write-reservation password for this file. If a file is saved with the password and the password is not supplied when the file is opened, the file is opened as read-only.
ReadOnlyRecommended
Type: System.Objecttrue to display a message when the file is opened, recommending that the file be opened as read-only.
CreateBackup
Type: System.Objecttrue to create a backup file.
AddToMru
Type: System.Objecttrue to add this workbook to the list of recently used files. The default value is false.
TextCodepage
Type: System.ObjectNot used in U.S. English Excel.
TextVisualLayout
Type: System.ObjectNot used in U.S. English Excel.
Local
Type: System.Objecttrue saves files against the language of Excel (including control panel settings). false (default) saves files against the language of Visual Basic for Applications (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example uses the SaveAs method to save an unprotected copy of the current Microsoft.Office.Tools.Excel.ChartSheet.
Private Sub SaveCopy()
Globals.Sheet1.Range("A1", "A5").Value2 = 22
Globals.Sheet1.Range("B1", "B5").Value2 = 55
Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
Excel.XlRowCol.xlColumns)
Me.ChartType = Excel.XlChartType.xl3DColumn
Me.SaveAs("CopyOfOriginal.xlsx", ReadOnlyRecommended:=False)
End Sub
private void SaveCopy()
{
Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
Globals.Sheet1.Range["B1", "B5"].Value2 = 55;
this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
Excel.XlRowCol.xlColumns);
this.ChartType = Excel.XlChartType.xl3DColumn;
this.SaveAs("CopyOfOriginal.xlsx");
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.