NativeExcel for .Net Developer's Reference

INames.Count Property

Returns the number of defined names in the collection.

[Visual Basic]
PropertyReadOnlyCountAsInteger
[C#]
intCount{get;}
[C++]
__propertyintget_Count();
[JScript]
functiongetCount():int

Property Value

System.Int32. The number of names in the INames collection.

Example

This example deletes all the defined names from the worksheet one.

[C#]
INames names = Workbook.Worksheets[1].Names;
int cnt = names.Count;
if (cnt > 0) {
   for (int i = cnt; i > 0; i--) names[i].Delete();
}            
[VisualBasic]
Dim names As INames = Workbook.Worksheets(1).Names
Dim cnt As Integer = names.Count
Dim i As Integer 
If cnt > 0 Then
   For i = cnt To 1 Step -1
      names(i).Delete()  
   Next i   
End If
[C++]
INames* names = Workbook->Worksheets->Item[1]->Names;
int cnt = names->Count;
if (cnt > 0) {
   for (int i = cnt; i > 0; i--) names->Item[i]->Delete();
}            

See Also

INames Interface | NativeExcel Namespace | IWorksheet.Names property | IWorkbook.Names property | IName interface