Share via


Styles.Add Method

Creates a new style and adds it to the list of styles that are available for the current workbook.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Add ( _
    Name As String, _
    BasedOn As Object _
) As Style
'Usage
Dim instance As Styles
Dim Name As String
Dim BasedOn As Object
Dim returnValue As Style

returnValue = instance.Add(Name, BasedOn)
Style Add(
    string Name,
    Object BasedOn
)

Parameters

  • BasedOn
    Type: System.Object

    Optional Object. A Range object that refers to a cell that's used as the basis for the new style. If this argument is omitted, the newly created style is based on the Normal style.

Return Value

Type: Microsoft.Office.Interop.Excel.Style

Remarks

If a style with the specified name already exists, this method redefines the existing style based on the cell specified in BasedOn.

See Also

Reference

Styles Interface

Styles Members

Microsoft.Office.Interop.Excel Namespace