Export (0) Print
Expand All
Cut
Run
Expand Minimize

Save Method (Document Object)

Visual Studio .NET 2003

Saves the document.

[Visual Basic .NET]
Public Function Save( _
   Optional ByVal FileName As String =  _
) As vsSaveStatus
[Visual Basic 6]
Function Save( _
   Optional ByVal FileName As String =  _
) As vsSaveStatus
[C++]
HRESULT __stdcall Save(
   BSTR FileName,
   /* [out, retval] */ vsSaveStatus* retVal
);
[C#]
vsSaveStatus Save(
   string FileName
);
[JScript .NET]
public function Save(
   FileName : String
) : vsSaveStatus

Parameters

FileName
Optional. The name in which to save the document. Defaults to the pathname associated with this document. That is, if an empty string is passed, the document is saved with its current name.

Return Value

Returns a vsSaveStatus constant indicating whether or not the save was successful.

Remarks

If FileName cannot be written, such as when the disk is full or there are write permission problems, then Save produces an error. The file is saved with a new name based on FileName.

Example

Sub SaveExample()
   Dim objDoc As Document
   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")
   ' Create a document reference.
   objDoc = DTE.Documents.Item(1)
   ' Save the new text file.
   objDoc.Save("c:\temp\mynewdoc.txt")
End Sub

See Also

SaveAll Method | Saved Property (General Extensibility)

Applies To: Document Object

Show:
© 2015 Microsoft