Item Property
Item property as it applies to the MetaTags object.
Returns a Variant representing a property key/value pair.
expression.Item(PropertyKey)
*expression * Required. An expression that returns one of the above objects.
PropertyKey Required String. A string that contains an index number of the collection. The index starts at zero.
Item property as it applies to the Properties object.
Returns or sets a Variant that represents a property. Read/write.
expression.Item(PropertyKey)
*expression * Required. An expression that returns one of the above objects.
PropertyKey Required String. A string that contains an index number of the collection. The index starts at zero.
Item property as it applies to all other objects in the Applies To list.
Returns a an individual object in a collection.
expression.Item(Index)
*expression * Required. An expression that returns one of the objects in the Applies To list.
Index Required Variant. The name or ordinal value of the object within the collection. Index starts at zero.
Example
As it applies to the NavigationNodes collection.
The following example demonstrates returning a value by indexing an item in the collection. This example returns the label for the first navigation node in the navigation structure of the active Web.
Note You access the NavigationNodes collection through the Children property of the RootNavigationNode property of the active Web.
Private Sub GetNavigationNode()
Dim myWeb As WebEx
Dim myNavNodes As NavigationNodes
Dim myNavNodeLabel As String
Set myWeb = ActiveWeb
myNavNodeLabel = myWeb.RootNavigationNode _
.Children.Item(0).Label End Sub
As it applies to the MetaTags object.
The following statement returns the contents of a META tag that exists on a Web page in the active Web, and demonstrates the PropertyKey argument.
myMetaTagContents = ActiveWeb.RootFolder.Files _
.Item(0).MetaTags.Item("generator")
It isn't always necessary to specify the index or property name of the Item property when returning values from a collection. The following example returns a list of file names of each Web page that contains a META tag name equivalent to "generator" in the active Web, without specifying the Item property. FindGeneratorTags
retrieves a list of the files that contain the "generator" META tag and adds value of the Item property to the variable myMetaTag
, because in this case the value of the Item property is the same as the file name. This is different from the previous example, which returned the contents of the "generator" META tag.
Function FindGeneratorTags() As String
Dim myWeb As WebEx
Dim myMetaTags As MetaTags
Dim myMetaTag As Variant
Dim myFiles As WebFiles
Dim myFile As WebFile
Dim myMetaTagName As String
Dim myReturnFileName As String
Set myWeb = ActiveWeb
Set myFiles = myWeb.RootFolder.Files
With myWeb
For Each myFile In myFiles
Set myMetaTags = myFile.MetaTags
For Each myMetaTag In myMetaTags
myMetaTagName = myMetaTag
If myMetaTagName = "generator" Then
myReturnFileName = myReturnFileName & myFile.Name
End If
Next
Next
End With
FindGeneratorTags = myReturnFileName
End Function
Applies to | ListFields Collection | Lists Collection | MetaTags Collection | NavigationNodes Collection | PageWindows Collection | Properties Collection | Themes Collection | WebFiles Collection | WebFolders Collection | Webs Collection | WebWindows Collection