Help Center

CTextRange2.Copymethod

Copies the text to a data object.

Windowsmethoddocumented

Syntax

FUNCTION Copy (BYVAL pVar AS VARIANT PTR) AS HRESULT

Return value

If successful, it returns S_OK. Otherwise, it returns E_OUTOFMEMORY.

Description

Copies the text to a data object.

Remarks

The Cut, Copy, and Paste methods let you perform the usual Cut, Copy, and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to reference a text solution's own internal rich text formats.

To copy and replace plain text, you can use the GetText and SetText methods. To copy formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the GetFormattedText and SetFormattedText methods.

Reference

  • Defined in AfxNova/CTextRange2.inc:650
  • Documented in Windows/WIndows Controls/RichEdit/CTextRange2 Class.md
  • Topic: CTextRange2 Class