Edit

Share via


Selection.CopyFormat method (Word)

Copies the character formatting of the first character in the selected text.

Syntax

expression. CopyFormat

expression Required. A variable that represents a Selection object.

Remarks

If a paragraph mark is selected, Word copies paragraph formatting in addition to character formatting. You can apply the copied formatting to another selection by using the PasteFormat method.

Example

This example copies the formatting of the first paragraph to the second paragraph in the active document.

ActiveDocument.Paragraphs(1).Range.Select 
Selection.CopyFormat 
ActiveDocument.Paragraphs(2).Range.Select 
Selection.PasteFormat

This example collapses the selection and copies its character formatting to the next word.

With Selection 
 .Collapse Direction:=wdCollapseStart 
 .CopyFormat 
 .Next(Unit:=wdWord, Count:=1).Select 
 .PasteFormat 
End With

See also

Selection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.