CTextDocument2.Savemethod
Saves the document.
Syntax
FUNCTION Save (BYVAL pVar AS VARIANT PTR, BYVAL Flags AS LONG, BYVAL CodePage AS LONG) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
pVar | The save target. This parameter is a VARIANT, which can be a file name, or NULL. | |
Flags | File creation, open, share, and conversion flags. For a list of possible values, see Open. | |
CodePage | The specified code page. Common values are CP_ACP (zero: system ANSI code page), 1200 (Unicode), and 1208 (UTF-8). |
Return value
The return value can be an HRESULT value that corresponds to a system error or COM error code, including one of the following values.
Description
Saves the document.
Remarks
To use the parameters that were specified for opening the file, use zero values for the parameters.
If pVar is null or missing, the file name given by this document's name is used. If both of these are missing or null, the method fails.
If pVar specifies a file name, that name should replace the current Name property. Similarly, the Flags and CodePage arguments can overrule those supplied in the Open method and define the values to use for files created with the New_ method.
Unicode plain-text files should be saved with the Unicode byte-order mark (0xFEFF) as the first character. This character should be removed when the file is read in; that is, it is only used for import/export to identify the plain text as Unicode and to identify the byte order of that text. Microsoft Notepad adopted this convention, which is now recommended by the Unicode standard.
Reference
- Documented in Windows/WIndows Controls/RichEdit/CTextDocument2 Class.md
- Topic: CTextDocument2 Class