NamedRange.Characters Property
This page is specific to:.NET Framework Version:
2.03.54
Excel Object Model Reference (Visual Studio Tools for Office)
NamedRange.Characters Property

Gets a Microsoft.Office.Interop.Excel.Characters object that represents a range of characters within the text of the NamedRange control.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

Syntax

'Declaration

Public ReadOnly Property Characters As _CharactersType

Property Value

A Microsoft.Office.Interop.Excel.Characters object that represents a range of characters within the text of the NamedRange control.
Remarks

The Characters property is intended to be used with the following parameters.

Parameter

Description

Start

The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.

Length

The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

If you attempt to use Characters without specifying any parameters, Characters will get a NamedRange._CharactersType object that is part of the Visual Studio Tools for Office infrastructure and is not intended to be used directly from your code.

You can use the Microsoft.Office.Interop.Excel.Characters object to format characters within a text string. The Microsoft.Office.Interop.Excel.Characters object is not a collection.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

Example

The following code example creates a NamedRange and populates it with the word Smith. It then changes the first character in the word by making it bold and setting the size to 14.

Private charactersRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub FormatCharacters()
    charactersRange = Me.Controls.AddNamedRange( _
        Me.Range("A1", "A1"), "charactersRange")
    Me.charactersRange.Value2 = "Smith"
    Me.charactersRange.Characters(1, 1).Font.Bold = True
    Me.charactersRange.Characters(1, 1).Font.Size = 14
End Sub

See Also

© 2010 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View