TextSelection.Copy Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Copies the text selection to the clipboard.
public:
void Copy();
public:
void Copy();
void Copy();
[System.Runtime.InteropServices.DispId(20)]
public void Copy ();
[<System.Runtime.InteropServices.DispId(20)>]
abstract member Copy : unit -> unit
Public Sub Copy ()
- Attributes
Examples
Public objSel As TextSelection = DTE.ActiveDocument.Selection
Sub CopyExample()
' Before running this example, open a text document.
' Perform operations on the text.
objSel.StartOfDocument(False)
Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, 4)
objSel.Copy()
Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)
objSel.Cut()
Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)
objSel.Delete()
Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)
objSel.DeleteLeft(6)
objSel.DestructiveInsert("NEW TEXT")
End Sub
Sub Position(ByVal pos As vsStartOfLineOptions, ByVal ipos As Integer)
' Moves the insertion point down to the beginning of the next line,
' then highlights the right-most four characters.
objSel.LineDown()
objSel.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
objSel.CharRight(True, 4)
End Sub