Property Properties

Name

Returns

Description

IndexedValue

Variant

Parameters: Indexl, [Index2], [Index3], [Index4]. The Value of the Property can be an array of up to four indices. The IndexedValue can be used to read a single item in the returned array.

Name Returns

Description

Name String

Read-only. Returns the name of the property, and is also used to refer to a specific property.

NumIndices Integer

Read-only. If the value of the Property is an array, Numlndices returns the number of indices (dimensions) in the array. If not an array, it returns 0.

Object Object

Used to obtain a reference to the object returned by the Property, if any.

Value Variant

The value of the Property.

It is easy to get confused between the many types of Name property of a VBComponent, which are summarized in the following table.

Syntax

Refers to

Worksheet.CodeName

The code name of the VBComponent (read-only).

VBComponent.Name

The code name of the VBComponent (read/write).

VBComponent.Properties ("CodeName")

The code name of the VBComponent (read-only). (This was the only reliable way to change a worksheet's CodeName in Excel 97.)

VBComponent.Properties ("_CodeName")

The code name of the VBComponent (read/write).

VBComponent.Properties ("Name")

The name of the worksheet (read/write).

VBComponent.Properties ("Name").Name

"Name".

This simple example identifies the workbook containing a given VBComponent:

Sub IdentifyWorkbook()

Dim oBk As Workbook

Sub IdentifyWorkbook()

Dim oBk As Workbook

'Get the workbook containing a given VBComponent Set oBk =

Application.VBE.ActiveVBProject.VBComponents("Sheet1").Properties("Parent").Object

MsgBox oBk.Name End Sub

0 0

Post a comment