MetaTags Collection Object

See Also         Properties                 

Application object
Webs object
Web object
RootFolder object
Files object
File object
MetaTags collection

An array of PropertyKey/Value pairs. Each MetaTag object represents a META tag contained on an HTML page in Microsoft FrontPage. The MetaTags collection is a member of the WebFile object.

Note   META tags generated by FrontPage, such as META tags for a theme or border, won't show up in the MetaTags collection. The MetaTags collection is only propagated after the file is saved. For example, if you add a new META tag to a page by using the HTML view or by programmatically using the Page object model in Microsoft Visual Basic for Applications, you won't be able to view the PropertyKey/Value pairs until after you save the page. To save space in the META dictionary, you can use the following methods to disable the META tag store:

The DisableMetaTagStore key functions in the same way as other server settings, see the Server Extensions Resource Kit for more information on server settings.

Using the MetaTags Collection

Use the MetaTags property to return the MetaTags collection.

HTML Note   In the meta data for FrontPage, the HTTP-EQUIV attribute can be used in place of the NAME attribute. FrontPage doesn't use the value of HTTP-EQUIV attribute in response message headers. The syntax for META data is as follows:

<META
CONTENT=description
HTTP-EQUIV=text
NAME=text
TITLE=text
URL=url
>

You can also return a list of the META tags that exist in the active web, by accessing the file structure through the root folder of the ActiveWeb object, as shown in the following example.

Note   To run this example, create a form with a text box called txtMetaTags (set to multiple lines) and a command button called cmdGetMetaTagInfo, and copy the example into the code window.

Private Sub cmdGetMetaTagInfo_Click()
Dim myWeb As Web
Dim myFiles As WebFiles
Dim myFile As WebFile
Dim myMetaTags As MetaTags
Dim myMetaTag As Variant
Dim myFileName As String
Dim myMetaTagName As String
Dim myReturnInfo 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
            myFileName = myFile.Name
            myMetaTagName = myMetaTag
            myReturnInfo = myFileName & ": " & myMetaTagName
            txtMetaTags.Text = txtMetaTags.Text & myReturnInfo
        Next
    Next
    txtMetaTags.SetFocus
    txtMetaTags.CurLine = 0
End With
End Sub

Use the Application property to return the Application object. The following statement returns the Application object.

myAddInsCount = ActiveWeb.RootFolder.Files(0).MetaTags.Application

Use the Count property to return the number of MetaTag objects in the collection. The following statement returns the number of MetaTag objects in the tenth file of the ActiveWeb object.

myMetaTagCount = ActiveWeb.RootFolder.Files(9).MetaTags.Count

Use Items(index), where index is the PropertyKey value as a string, of an item in the MetaTags collection to return the PropertyKey/Value pair. The following example returns the program identification tag from the META tags in the first file of the ActiveWeb object.

myMetaTagOne = ActiveWeb.RootFolder.Files(0).MetaTags("ProgId")

Common PropertyKey values are "generator" and "progid". For more information on PropertyKey values, see the table in the Properties object.

Use the Parent property when you want to return the file container for the MetaTags collection. For example, the following example returns the Url property of the WebFile container object that is associated with the META tags for the first file of the ActiveWeb object.

myMetaTagParent = _
    ActiveWeb.RootFolder.Files(0).MetaTags.Parent.Url