Microsoft FrontPage Objects

Application
 DispFPHTMLDocument
AnswerWizard
COMAddIns
CommandBars
FileSearch
LanguageSettings
System
Themes
Webs
WebEx
HomeNavigationNode
Properties
RootFolder
Files
File
MetaTags
Properties
Folders
Folder
Files (File)
Folders (Folder)
Properties
RootNavigationNode
NavigationNodes (NavigationNode)
Themes (Themes)
WebWindows (WebWindowEx)
Lists
List
ListFields
ListField
WebWindows
WebWindowEx
PageWindows
PageWindowEx
Document
WebEx

Legend

Object and collection
Object only


Creating Web Sites

Some of the content in this topic may not be applicable to some languages.

Microsoft FrontPage makes FrontPage-based web creation as easy as creating a new folder on your hard drive. The key to successful web management in FrontPage is planning the structure and design of your webs. With most Web servers, you have one Web site, but with FrontPage, you can create as many webs as you want, including nested webs. A FrontPage-based web comprises three layers—web structure, folder structure, and navigation structure. Click one of the links below to select a specific topic.

Understanding FrontPage Web Structure

Understanding FrontPage Folder Structure

Understanding Navigation Structure

Creating Web Sites Programatically

Creating a Web Site with the Add Method

Creating a Web Site with the MakeWeb Method

Understanding FronPage Web Structure

Any folder on your Web server can be a web with its own folder hierarchy that can include subwebs below the original web. When you install FrontPage, the program automatically provides a default name for your main web. On a disk-based system, the default name is C:\My Documents\My Webs for a Microsoft Windows operating system or C:\WINNT\Profiles\logon alias\Personal\My Webs for a Microsoft Windows NT operating system. You may want to name the individual subwebs for the various company names themselves, such as Adventure Works, American Society of Science, Mightyflight Toys, or Rogue Cellars.

FrontPage provides a variety of web templates—corporate, discussion, customer support, and so on. These templates provide the foundation of the structure for each web. For example, Adventure Works may want you to establish a full-blown corporate presence for their Web site; and so on. The web hierarchy for a disk-based web is shown in the following diagram.

The following figure shows the web structure in Folders view. The subwebs display a small globe within the folder icon.

Understanding FrontPage Folder Structure

The folder structure in FrontPage behaves in the same manner as the folder structure in Windows Explorer. However, to access these files from Windows Explorer, you have to export them to another location—either your hard drive or server. During the export process, the files are converted to HTML pages. In that sense, opening FrontPage is similar to opening a window to your webs. The folder hierarchy for a disk-based web is shown in the following diagram.

The following diagram shows the folder structure in Folders view.

Note This diagram displays the same information as the previous one because both folders and webs are displayed in the same view, but you can see from the web and folder diagrams that they each have their own structure. A web or subweb is a folder. However, a folder that is also a web contains meta data about that web. For example, if you apply a theme to one of your webs, all folders within that web will have the same theme. However, you can apply different themes to the webs on your Web server. When you change a web to a folder, you remove special settings that make that folder a web, and settings such as the theme change to match the "global" theme for the disk-based or server-based web that provides the container for your FrontPage-based subwebs.

Understanding Navigation Structure

You can create files within your web, but the navigation structure that links these files to your web isn't automatically created when the files are created. However, each subweb can have its own home page. A home page is usually the starting page for any web in the navigation structure; but in FrontPage you can create alternate pages that exist at the same navigation level as the home page. You may want to add links to a home page that navigate to home pages of other subwebs that you're maintaining.

The navigation structure contains nodes that link each of the pages in your subwebs and provide pointers to the locations of each page in the navigation structure. The navigation structure for a disk-based web is shown in the following diagram.

The following diagram shows the navigation structure in Navigation view.

Creating Web Sites Programmatically

Here's a very simple design for a web. The Rogue Cellars company wants to add a subweb called Wines Around the World that will start with pages for two regions, Spain and France. The folder structure will contain the Rogue Cellars web and the folder for the subweb, Wines Around the World, plus the hidden folder _private, and an Images folder. The navigation structure will contain the Wines Around the World home page (index.htm) and the two child pages (Spain.htm and France.htm—the left and right nodes in the navigation structure).

There are two ways to create FrontPage-based webs in Microsoft Visual Basic for Applications. You can use the Add method with the Webs collection, or you can use the MakeWeb method with a WebFolder object to change an existing folder into a web.

Creating a Web Site with the Add Method

Once you've designed how your Web site is going to look and function, you can use the Set statement as shown in the procedure below to create a new web.

Note To run the examples in this topic, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). Or, you may substitute a web and files of your choice.

Private Sub Add()
    Dim myNewWeb As WebEx

    Set myNewWeb = _
        Webs.Add("C:\My Webs\Rogue Cellars\Wines Around the World")
End Sub

When you create a web with this method, you only create the web and its folder; you don't create a complete Web site with all of the folders, pages, and navigation in place. The next step is adding a home page. The following statements shown in bold adds a home page and is added to the previous procedure.

Private Sub Add()
    Dim myNewWeb As WebEx
    Dim myFiles As WebFiles Dim myUrl As String

    Set myNewWeb = _
        Webs.Add("C:\My Webs\Rogue Cellars\Wines Around the World")
    Set myFiles = myNewWeb.RootFolder.Files myFileUrl = _         "C:\My Webs\Rogue Cellars\Wines Around the World\index.htm" myFiles.Add(myFileUrl)
End Sub

Because index.htm or default.htm are file names associated with names commonly used as home pages, FrontPage creates the appropriate navigation structure for a home page whenever you use one of these names. However, if you add further pages using the Add method with the WebFile object, you will add pages, but FrontPage will not automatically create the navigation structure for you—you will have to add the navigation structure manually as is illustrated in the following statements shown in bold.

Note The following example creates a new web in the Rogue Cellars web and creates two pages in the new web: index.htm and Spain.htm.

Private Sub AddCompleteWeb()
    Dim myNewWeb As WebEx
    Dim myFiles As WebFiles
    Dim myUrl As String
    Dim myFileOne As String

    Set myNewWeb = _
        Webs.Add("C:\My Webs\Rogue Cellars\Wines Around the World")
    Set myFiles = myNewWeb.RootFolder.Files
    myFileUrl = _
        "C:\My Webs\Rogue Cellars\Wines Around the World\index.htm"

    myFiles.Add(myFileUrl)
    myFileOne = "C:\My Webs\Rogue Cellars\Wines Around the World\" myFileOne = myFileOne & "Spain.htm" myFiles.Add myFileOne Call myNewWeb.HomeNavigationNode.Children.Add(myFileOne, "Spain", _         fpStructLeftmostChild) myNewWeb.ApplyNavigationStructure

End Sub

Notice the last statement in bold—this method applies the changes that you've made to the navigation structure.

There are several constants you can use in the Add method for the Children property: fpStructBaseOnSibling, fpStructLeftmostChild, and fpStructRightmostChild. Very simply, these constants inform FrontPage which position you want to apply to the file in the navigation structure—left, right, or base the position on one of the siblings. Here, myFileOne becomes the leftmost child of the home page. The next step is to add the next page, so that you can view the navigation structure in Navigation view. The following statements shown in bold add another page and navigation node to the previous web.

Private Sub Add()
    Dim myNewWeb As WebEx
    Dim myFiles As WebFiles
    Dim myFileUrl As String
    Dim myFileOne As String
    Dim myFileTwo As String

    Set myNewWeb = _
        Webs.Add("C:\My Webs\Rogue Cellars\Wines Around the World")
    Set myFiles = myNewWeb.RootFolder.Files
    myFileUrl = _
        "C:\My Webs\Rogue Cellars\Wines Around the World\index.htm"

    myFiles.Add(myFileUrl)
    myFileOne = "C:\My Webs\Rogue Cellars\Wines Around the World\"
    myFileOne = myFileOne & "Spain.htm"
    myFileTwo = "C:\My Webs\Rogue Cellars\Wines Around the World\" myFileTwo = myFileTwo & "France.htm"

    myFiles.Add myFileOne
    myFiles.Add myFileTwo
    Call myNewWeb.HomeNavigationNode.Children.Add(myFileOne, "Spain", _
        fpStructLeftmostChild)
    Call myNewWeb.HomeNavigationNode.Children.Add(myFileOne, "Spain", _         fpStructRightmostChild)

    myNewWeb.ApplyNavigationStructure

End Sub

You can continue to add pages and navigation nodes to your web in this way until your web is complete. Or, you can create a For loop where you iterate through the web adding the number of pages and navigation nodes you need to complete the web. The following example adds five pages and navigation nodes to a new web in the Rogue Cellars web.

Note Creating, moving, or deleting files and folders while attempting to modify the navigation structure may cause some changes to be lost. First, make the changes to the folder structure of the web, then make the navigation structure changes, and then apply the navigation structure to the web.

Private Sub AddDesignerCrystalWeb()
    Dim myWeb As WebEx
    Dim myParentWeb As WebEx
    Dim myFolders As WebFolders
    Dim myFolder As WebFolder
    Dim myFiles As WebFiles
    Dim myNewFiles(4) As WebFiles
    Dim myChildNode As NavigationNode
    Dim myNewFilename As String
    Dim myFileURL As String
    Dim myCount As Integer
    Dim myBaseURL As String
    Dim myWebURL As String
    Dim myInputMsg As String
    Dim myExist As Boolean

    Set myParentWeb = _
        Webs.Open ("C:/My Documents/My Webs/Rogue Cellars/")
    myParentWeb.Activate

    myBaseURL = "C:/My Documents/My Webs/Rogue Cellars/"
    myWebURL = myBaseURL & "Rogue Cellars Designer Crystal"
    myExist = False
    myInputMsg = _
        "All files will have "".htm"" appended. Type a file name: "
    Set myFolders = Webs(0).RootFolder.Folders

    For Each myFolder In myFolders
        'Check to see if myWebURL already exists.
        If myFolder.IsWeb And myFolder.Url = myWebURL Then
            myExist = True
        End If
    Next

    'Create myWebURL if it doesn't exist.
    If myExist = False Then Webs.Add(myWebURL).Activate
    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    'Create files.
    For myCount = 0 To UBound(myNewFiles)
        myNewFilename = InputBox(myInputMsg)
        myFileURL = myWeb.Url & "/" & myNewFilename & ".htm"
        myFiles.Add myFileURL
        myFiles(myFileURL).Edit
    Next

    'Add to navigation structure.
    For myCount = 0 To UBound(myNewFiles)
        'Check if the current page is index.htm, if so, skip it.
        If myFiles(myCount).Title = "index.htm" Then
            myCount = myCount + 1
        End If
        Set myChildNode = _
          myWeb.RootNavigationNode.Children(0)
        'Add navigation node to the current page.
        myChildNode.Children.Add myFiles(myCount).Url, _
            myFiles(myCount).Title, fpStructLeftmostChild
    Next
    myWeb.ApplyNavigationStructure
End Sub

Creating a Web Site with the MakeWeb Method

If you already have an existing folder that you'd like to convert to a web, you can use the MakeWeb method with a WebFolder object as shown in the following procedure.

Note This procedure assumes that Webs(0) is the Rogue Cellars web and that it contains a folder called FolderOne.

Private Sub MakeAWeb()
    Dim myWeb As WebEx
    Dim myFolder As WebFolder

    Set myWeb = Webs(0)
    myWeb.Activate
    Set myFolder = ActiveWeb.RootFolder.Folders("FolderOne")
    myFolder.MakeWeb
End Sub

You will need to create a navigation structure once PageOne is a subweb of Rogue Cellars.


Exploring Procedures

This topic is designed to give users who may be familiar with Microsoft FrontPage, but unfamiliar with Microsoft Visual Basic for Applications, a background on some of the basic concepts in a FrontPage-based programming environment. Programming in FrontPage Visual Basic for Applications provides you with HTML tools in an Microsoft Office programming environment where you can create procedures that perform a task or a series of tasks. For example, you could:

  • Create a procedure that retrieves data from a Microsoft Access database and displays the data on your web page.
  • Publish a Microsoft PowerPoint presentation for automatic updates over the Internet.
  • Automatically update a Microsoft Excel spreadsheet with input from users responding to your Web site.

Click a hyperlink in the following list to move directly to that topic.

Organize code for modular use

Types of procedures

Public and private procedures

Types of procedure calls

Event procedures and arguments

Create a table in FrontPage from an Access database

Multiple projects

Organize code for modular use

Visual Basic procedures provide a way for developers to organize code for modular use. Instead of writing the same calculator function over and over for each program, you can take that segment of code (the calculator function) and compile it into a general program, that can then be accessed by many other programs. In Visual Basic, a block of code is enclosed between a procedure heading and a closure statement—the Sub and End Sub statements.

The basic syntax of a procedure within Visual Basic is shown in the following code sample.

[Private|Public|Static] Sub procedurename(arguments)

statements

End Sub

To run any of the complete code samples (code blocks) follow these steps:

  1. Open FrontPage, select Macro from the Tools menu, and then click Visual Basic Editor.
  2. Double-click Microsoft_FrontPage (or the current project) in the Project window and expand the Modules folder.
  3. Double-click Module 1 to open the Code window.
  4. Copy the code block from the documentation, and then paste it into the Code window.
  5. Click Run Sub/UserForm on the toolbar.

Your code will automatically be saved when you close the Visual Basic Editor.

Types of procedures

FrontPage Visual Basic provides two types of procedures, Sub and Function procedures. Sub procedures execute a block of code in response to an event procedure, such as a mouse click or a keystroke, they perform tasks but do not return any values.

Note A Sub procedure can be an event procedure, but it can perform a task without necessarily responding to an event.

The following procedure retrieves the version number of FrontPage from the active web, but it doesn't return the version number to any other procedure.

Sub DisplayVersion()
    Dim myWeb As WebEx
    Dim myVersion As String

    myVersion = "FrontPage version number: " & ActiveWeb.Application.Version
End Sub

A Function procedure also performs tasks, but it can in addition return one or more values as arguments. The following code sample returns the version number of FrontPage to a calling procedure.

Function ReturnVersion(vaAppVersion As Variant)
    Dim varAppVersion As Variant
    varAppVersion = Application.Version
    ReturnVersion = varAppVersion
End Function

The variable ReturnVersion now contains the version number of FrontPage. To access this value in the calling procedure, you could write code similar to the following sample.

Sub GetAppVersion()
    Dim myAppVersion As Variant

    MsgBox "This version of FrontPage is version " _
    & ReturnVersion(myAppVersion)
End Sub

Alternatively, you could assign the expression ReturnVersion(varAppVersion) to a variable and append the variable to the message box statement instead of the function call.

Both Sub and Function procedures can be called to perform their tasks, depending on whether the procedures are declared Public or Private.

Note To use the previous function for more than one module, place the code in the Declarations section of the General procedure.

A macro is a third term used to describe code in Visual Basic for Applications. As a public Sub procedure that doesn't take arguments, a macro may or may not call other Sub or Function procedures and can be assigned to command bars and shortcut keys or run from the Macro dialog box.

Public and private procedures

Visual Basic provides two ways to access a procedure. By default, procedures are public—they can be called from any other procedure in any module within your application. For example, if you've written a procedure that lists images by file name on a Web page, you would want to declare that procedure public so that you could use it across all of your Web sites. However, if you've written a procedure that edits a specific database, you would want that procedure to be available only to the module that handles editing the database—in that case, you can declare the procedure private. Procedures that have been declared private can only be referenced by other procedures within the same module. The function shown previously has been declared a public function in the following code sample and can be called across modules and projects.

Public Function ReturnVersion(varCurrentAppVersion As Variant)
    statements
End Function

In contrast, a procedure that is used to edit a database should be declared private.

Private Function EditCustomerName(strFirstName As String)
    statements
End Function

Types of procedure calls

How do you programmatically run a procedure? You declare it the same way that you would use a keyword, such as Open. The following procedure calls the ReturnVersion function and includes a local variable, MyVersion, for the value that is passed to the procedure.

Function TestCall(AppVersion As Variant)
    Dim MyVersion As Variant
    ReturnVersion(MyVersion)
End Sub

If you didn't have any information to pass from one procedure to another, you would simply declare the procedure name, as shown in the following code sample.

Sub TestCall2()
    DisplayCompanySplashScreen
End Sub

The TestCall2 procedure calls another procedure, DisplayCompanySplashScreen, which doesn't take any arguments or return any values.

Event procedures and arguments

If you want an event, such as clicking a command button, to trigger the execution of code in cases where you would usually pass a value to the calling procedure, you can execute the results from the function rather than pass a variable. Adding the following code shown in bold to the ReturnVersion function initiates the display of the version number for the active application.

Function ReturnVersion(varCurrentAppVersion As Variant)
    Dim varAppVersion As Variant
    varAppVersion = Application.System.Version
    varCurrentAppVersion = varAppVersion
    DisplayMsgBox (varCurrentAppVersion)
End Function

The DisplayMsgBox function shown in the following code sample displays the contents of the variable varCurrentAppVersion that was passed from the ReturnVersion function.

Function DisplayMsgBox(varGotAppVersion As Variant)
    Dim varDisplayAppVersion As Variant
    VarDisplayAppVersion = varGotAppVersion
    MsgBox "This application is version " _
        & varDisplayAppVersion
End Function

An event procedure can now initiate the display of the value that is passed from the ReturnVersion function.

Private Sub CommandButton1_Click()
    Dim varThisAppVersion As Variant
    ReturnVersion (varThisAppVersion)
End Sub

Create a table in FrontPage from an Access database

The following procedure combines objects from the Page object model and the Web object model to retreive data from an open Microsoft Access database and insert it into a table on a FrontPage-based web page. The ParseDBTable procedure provides the parameters for the ParseAccessTable function which calls the following functions to create and populate the table:

  • AddDBTableToPage—creates a new table
  • AddDBRow—inserts a row onto the web page
  • AddMemo—retrieves the memos from the Access database, returns them as bookmarks at the bottom of the page below the new table, and returns the URL to the bookmark

Note The Access database, Northwind.mdb, was used for this example. To run the example, you must have references in the Visual Basic Editor to Microsoft DAO 3.6 Object Library and the Microsoft Access Object Library. You must also open an Access database before running the example, and you must add a blank temporary file called tmp.htm in the active web. If you use a database other than Northwind.mdb, you must specify the database name and table in the ParseDBTable procedure.

Function AddDBTableToPage(myPage As PageWindowEx, _
    myTableName As String, myFields As Integer)
    Dim myTable As FPHTMLTable
    Dim myHTMLString As String
    Dim myCount As Integer

    myHTMLString = "<table border=""2"" id=""myRecordSet_" & _
    myTableName & """>" & vbCrLf
    myHTMLString = myHTMLString & "<tr>" & vbCrLf

    For myCount = 1 To myFields
        myHTMLString = myHTMLString & "<td id=""myDBField_" & _
            myCount & """> </td>" & vbCrLf
    Next myCount

    myHTMLString = myHTMLString & "</tr>" & vbCrLf
    myHTMLString = myHTMLString & "</table>" & vbCrLf

    Call myPage.Document.body.insertAdjacentHTML("BeforeEnd", _
        myHTMLString)

End Function

Function AddDBRow(myDBTable As FPHTMLTable)
    Dim myHTMLString As String
    Dim myTableRow As FPHTMLTableRow

    Set myTableRow = myDBTable.rows(0)

    myHTMLString = myTableRow.outerHTML
    Call myDBTable.insertAdjacentHTML("BeforeEnd", myHTMLString)

End Function

Function AddMemo(myCurrentPage As PageWindowEx, myDBMemo As String, _
    myBkMarkField As String, myIndex) As String
    Dim myHTMLString As String
    Dim myMemoBkMark As String
    Dim myBookMark As FPHTMLAnchorElement

    myMemoBkMark = myBkMarkField & "_" & myIndex
    myHTMLString = "<a name=""" & myMemoBkMark & """> Memo #" & _
    myIndex & "</a>" & vbCrLf

    'Add the bookmark to the page.
    Call myCurrentPage.Document.body.insertAdjacentHTML("BeforeEnd", _
        myHTMLString)

    Set myBookMark = myCurrentPage.Document.all(myMemoBkMark)

    'Add the memo text to the page.
    Call myCurrentPage.Document.body.insertAdjacentHTML("BeforeEnd", _
        myDBMemo)
    AddMemo = "<a href=""#" & myBookMark.Name & """>"

End Function

Function ParseAccessTable(myDBName As String, myTableName As String)
    'Access/DAO Declarations.
    Dim myDBApp As Access.Application
    Dim myRecordSet As DAO.recordset
    Dim myDBField As DAO.Field

    'FrontPage Page object model declarations.
    Dim myPage As PageWindowEx
    Dim myTable As FPHTMLTable
    Dim myTableRow As FPHTMLTableRow
    Dim myTableCell As FPHTMLTableCell

    'Function declarations.
    Dim myCount As Integer
    Dim myFieldValue As String
    Dim myRecordCount As Integer
    myRecordCount = 0

    'Function constants.
    Const myTempPage = "tmp.htm"

    'Get the current Access database.
    On Error GoTo AccessNotThereYet
        Set myDBApp = GetObject(, "Access.Application")

    'Get the database table.
    On Error Resume Next
    Set myRecordSet = myDBApp.CurrentDb.OpenRecordset(myTableName)

    'Add a new page to the current web.
    Set myPage = ActiveWeb.LocatePage(myTempPage)
    myPage.SaveAs myTableName & ".htm"

    'Delete the temporary file from web.
    ActiveWeb.LocatePage(myTempPage).File.Delete

    'Add a database-ready table to the page with the proper number of fields.
    AddDBTableToPage myPage, myTableName, myRecordSet.Fields.Count

    'Get a reference to the table.
    Set myTable = myPage.Document.all.tags("table").Item(0)

    'Populate the first row.
    For myCount = 0 To myRecordSet.Fields.Count - 1
        myTable.rows(0).cells(myCount).innerHTML = "<b>" & _
            Trim(myRecordSet.Fields(myCount).Name) & "</b>"
    Next

    'Populate the rest of the table.
    While Not (myRecordSet.EOF)

        AddDBRow myTable
        Set myTableRow = myTable.rows(myTable.rows.Length - 1)

        For myCount = 0 To myRecordSet.Fields.Count - 1
            Set myTableCell = myTableRow.cells(myCount)

            If IsNull(myRecordSet.Fields(myCount)) Then
                myFieldValue = "None"
            Else
                myFieldValue = Trim(myRecordSet.Fields(myCount).Value)
            End If

            If myRecordSet.Fields(myCount).Type = DAO.dbMemo Then
                myFieldValue = AddMemo(myPage, _
                    myRecordSet.Fields(myCount).Value, _
                    myRecordSet.Fields(myCount).Name, myRecordCount)
            End If

            myTableCell.innerHTML = myFieldValue

        Next myCount
        myRecordSet.MoveNext
        myRecordCount = myRecordCount + 1
    Wend

    myPage.Save
    myDBApp.Quit
    Exit Function

    AccessNotThereYet:
        Debug.Print Err.Number & ":" & Err.Description
        Resume

End Function

Private Sub ParseDBTable()
    Call ParseAccessTable("Northwind.mdb", "Products")
End Sub

Multiple projects

FrontPage doesn't support multiple projects. You can install the Microsoft Office XP Developer to add flexibility to your Visual Basic Editor. Office XP Developer provides the capability of creating multiple projects, compiling .dlls, and managing your Visual Basic projects more effectively.


Sharing Programming Projects

Microsoft FrontPage doesn't provide the ability to create multiple projects, so sharing a project may be a little confusing at first glance. You can share your Microsoft FrontPage projects using one of the following three methods:

  • As a ComAddIn.
  • By exporting the .bas, cls, and .frm modules to a directory on your hard drive (or a server location). So that the user can import the modules to their project in FrontPage.
  • Use the Microsoft Office Developer to open the project.

Sharing as a COMAddIn

For a detailed description of how to develop a COM add-in, see the chapter "Add-ins, Templates, Wizards, and Libraries" in the Microsoft Office 2000 Developer's Guide.

Sharing by exporting the project

You can export your modules from the Visual Basic Editor by selecting the module in the Project window and then pointing to Export File on the File menu. In the Export File dialog box, select the directory you want the file to reside in and FrontPage takes care of the rest.

Note When exporting UserForm files, you must also include the .frx files. This file is used during the import process and does not need to be imported, but does need to be available in the same directory as the other modules.


Understanding Absolute and Relative URL Addressing in Microsoft FrontPage

Microsoft FrontPage uses absolute URL addressing. However, FrontPage does provide a way to change the addressing of URLs between absolute and relative addressing through the MakeRel and MakeAbs methods.

What is an absolute URL?

A URL defines the location of an object. When a URL is absolute, it defines unambiguously where the object is located. For example, http://www.microsoft.com/FrontPage/default.htm is the exact location of the welcome page for Microsoft FrontPage. The object, default.htm, is stored in the FrontPage folder or subweb on the web server, www.microsoft.com.

A disk-based web that contains your webs on your hard drive might have a base absolute URL such as file:///C:/My Documents/My Webs or C:/WINNT/Profiles/your logon alias/Personal/My Webs/index.htm.

As Web sites are updated and the structure of a web evolves, documents can often be moved from one location to another in a web. If you're using a relative address, you may break some links. For example, if you have a document that has a hyperlink to an object, you can use an absolute URL to insure that the hyperlink always refers to that object. For example, a document such as file:///C:/My Documents/My Webs/mydocument.htm, may contain an absolute URL that refers to the welcome page, http://www.microsoft.com/FrontPage/default.htm. If the document, default.htm, is moved to another location, the absolute URL for the document will always refer to the object on the web server at www.microsoft.com in the subweb, FrontPage. If the URL for the hyperlink to default.htm is a relative address, the link could be broken if mydocument.htm is moved to a different subweb or main web.

What is a relative URL?

Instead of specifying every piece of a URL that fully defines how to find an object, you can abbreviate a URL to make it "relative" to a current location. Relative URLs are typically used when creating a Web site in which the pages in it refer to other pages on the site. A page such as file:///C:/My Documents/My Webs/mydocument.htm can have a relative URL to "newdocument,htm" or to "../My Webs2/default.htm". In these two cases, the referred addresses for these files are file:///C:/My Documents/My Webs/newdocument.htm and file:///C:/My Documents/My Webs2/default.htm. Notice that the full Web server or explicit directory isn't specified; the location is based on where the document is located.

Relative URLs are very useful, particularly when constructing a site in one place and then publishing it to another place. For example, you might not want to specify a server name while authoring a web page, because the server name will change when the web is published.

How can an absolute URL be made relative?

URLs can be made relative either to a server or to a page. In order to make a URL relative to a folder or to a web, you need to make the URL relative either to a server or to a page, because FrontPage will treat the URL as if it were being made relative to a page in that folder or web. Each relative URL, combined with its base URL fully specifies where the object is located.

When you have an absolute address such as http://www.microsoft.com/myweb with an image file called MyPicture.gif residing in the images folder on the web, you can create a relative URL for that address by deciding whether the relative address will refer to a server or a page. For a server-relative URL, you'd use "myweb/images/MyPicture.gif" with the server name as the base for the relative URL; which fully defines the location of the object. For a page-relative URL, you'd use "images/MyPicture,gif" with theserver name and the web name as the base for the relative URL; which fully defines the location of the object. For a folder-relative URL, you'd use "MyPicture.gif" with the server name, web name, and folder name as the base for the relative URL, this relative address fully defines the location of the object.

A folder-relative URL can also be specified from a different folder for example, "../images/MyPicture.gif" could be used if the referring document was in another top level folder on the same web and server. The ".." is the notation used to indicate up one folder level from the current URL address.

Programmatic Access to Relative URLs

Once you've decided whether to use server, web, or folder-relative URLs, you can determine which objects to use. For server or web-relative URLs, you would be working with methods related to the Web object. For folder-relative URLs, you would be working with methods related to the WebFolder object.

Converting relative and absolute URLs

Recommended use for FrontPage is absolute addressing. However, once you have specified a relative URL within FrontPage, you can use the MakeAbs method to convert it into an absolute URL. Similarly, if you have an absolute URL and you want to insert a reference into a document as a relative URL, you can use the MakeRel method to convert the address to a relative address. You can also use the MakeAbs and MakeRel methods to convert a hyperlink for a WebEx, WebFolder, WebFileEx, NavigationNode, or IHTMLDocument2 object.


Exploring the Object Model in FrontPage

The Microsoft FrontPage object model consists of three separate object models—the Application object model, the Web object model, and the Page object model that is based on Microsoft Internet Explorer 4.0's Document object model.

These object models are designed to provide Web designers with a rich set of programmability interfaces to manage individual HTML documents and FrontPage-based webs. The object models parallel other Microsoft Office application object models as closely as possible in order to leverage the experience and knowledge users currently have with other programmable Office applications. In addition, the Page object model is compatible with the Document object model of Microsoft Internet Explorer 4.0 and later. The Page object model also leverages the experience and knowledge of web developers who program Dynamic HTML using script.

Differences in the Programmable Interfaces

FrontPage 2002 provides a design-time user experience versus a run-time user experience, because HTML pages are usually viewed in a browser rather than in FrontPage. Other Office applications provide a run-time user experience that contains an environment where the developer can create solutions for the user that run within the application. With FrontPage 2002, you can create utilities for use during the design phase of the HTML document or Web site and, once you have designed and built your web site, you can use VBScript, JScript, and DHTML to create interactive effects for use during run-time when the page is viewed in a browser.

Visit the Office Developer Center at MSDN Online for the latest Microsoft FrontPage development information, including new technical articles, downloads, samples, product news, and more.

Application Object Model Functionality

The Application object is the top-level object in the Web object model hierarchy and provides access to all of the objects in FrontPage, such as an active web, active page, add-ins, command bars, system, and webs.

FrontPage Page Object Model Functionality and Restrictions

The Page object model has all of the functionality of the Internet Explorer Document object model except for the restrictions previously noted and those noted in the following topics.

HTML Events not Supported by FrontPage2002

HTML Methods not Supported by FrontPage2002

HTML Properties not Supported by FrontPage2002

Web Object Model Functionality

The Web object model provides programmatic management of multiple FrontPage-based Web sites and their contents. This object model is based on conventions used by the Microsoft Office Applications suite and Microsoft Visual Basic for Applications. The Web object model also provides support for Microsoft Visual SourceSafe when accessed through FrontPage.

Object Model Interaction

Most of the programming for FrontPage-based webs will contain a combination of Web and Page object model programming elements. For additional information and examples of this, click a topic in the following list.

Accessing Framesets with Microsoft Visual Basic

Modifying Pages Programmatically

Programming Dynamic Elements


Accessing Framesets with Microsoft Visual Basic

Frames are an important part in the design of a web. Microsoft FrontPage provides support for programming the content of frames. Click one of the following links for more information on a particular topic.

Exploring Frames

Role of a Frameset

Accessing HTML Tags

Dynamic Framesources

Iterating all Frames in a page window

Changing Meta Tag Content to Another Character Set

Exploring Frames

Accessing frames within a frameset in FrontPage is relatively straightforward as long as you keep in mind that each frame accesses its own page and that you access the contents of each page through the Page object model. The two windows involved in displaying the frames are the PageWindowEx object and FPHTMLWindow2 objects. The equivalent expression to access the contents in the window associated with the active frame is Set myActiveFrameInFrameset = ActivePageWindow.Document. The ActivePageWindow object accesses the page window for the frame, and the Document object accesses the FPHTMLWindow2 object.

Note You may get permission denied errors if you try to access objects while in HTML view. When you want to add code or text to a document object, you must set the FpPageViewMode constant for the ViewMode property to fpPageViewNormal. The value for view mode cannot be set to fpPageViewHtml or fpPageViewPreview. Alternatively, in the FrontPage User Interface (UI), you cannot have the HTML tab or the Preview tab open in Page view..

Role of a Frameset

A frameset is the container for all of the frames in a web window. Each frame is contained in an individual page window and has an individual page associated with it. By accessing the FrameWindow object from the Web object model, you access an FPHTMLWindow2 object that contains the frame page document. From these objects you can access the windows, documents, and frames of the frameset. In the following statement,

myFrameset
is an FPHTMLWindow2 object that returns the frames page document. From this object, you can access the <FRAME> and <FRAMESET> tags, or the window or document objects.
Set myFrameset = ActivePageWindow.FrameWindow

This statement returns an FPHTMLWindow2 object through the Page object model. The Document property of myFrameset accesses the Page object model for the page that is equivalent to accessing the frames page HTML tab in Page view in FrontPage.

Note The Frames Page HTML and No Frames tabs are only available when frames exist on the current page.

Accessing HTML Tags

You can access the same information that a frames tag accesses by declaring an object as a FPHTMLFrameElement. Some of the properties and methods available for this object include border, borderColor, click, frameBorder, frameSpacing, innerHTML, innerText, insertAdjacentHTML, and insertAdjacentText.

Dim myFramesElements() As FPHTMLFrameElement

You can access the information for a frameset tag by declaring an FPHTMLFramesetSite object.

Dim myFramesetSite As FPHTMLFramesetSite

Dynamic Framesources

You can dynamically change the frame source in the HTML code by using the following statements. This code sets the frame source to a new URL, Inventory_1stQuarter.htm.

Dim myDoc As Object

Set myDoc = ActivePageWindow.FrameWindow.Document

myDoc.all.tags("frame").Item(0).src = _
    "Inventory_1stQuarter.htm"

Iterating all Frames in a Page Window

To access the properties of the frameset elements that reside in a particular frames page, you must access the DispFPHTMLDocument object through the Document property. The following example iterates through the frameset and frame elements for the active frameset in Microsoft FrontPage. The frameset array (myFSElements) comprises each <FRAMESET> tag on the frames page. The frames array (myFramesElements) comprises each <FRAME> tag on the frames page. The frame windows array (myFramesWindows) comprises each FPHTMLWindow2 object that points to each frame. You populate each of the arrays by iterating through their respective tags or objects. Once the arrays are populated, you change the frameSpacing property in the frameset element to "10", the borderColor property to "red", and change various other properties in the document.

Private Sub AccessFramesPage()
Dim myFPWindow As FPHTMLWindow2
Dim myFSElements() As IHTMLFrameSetElement
Dim myFramesWindows() As FPHTMLWindow2
Dim myFramesElements() As FPHTMLFrameElement
Dim myStyle As FPHTMLStyle
Dim i As Integer

Set myFPWindow = ActivePageWindow.FrameWindow
ReDim myFSElements(myFPWindow.Document.all.tags("FRAMESET").length)
ReDim myFramesElements(myFPWindow.Document.all.tags("FRAME").length)
ReDim myFramesWindows(myFPWindow.frames.length)

For i = 0 To UBound(myFSElements)
    Set myFSElements(i) = _
        myFPWindow.Document.all.tags("FRAMESET").Item(i)
Next i

i = 0
For i = 0 To UBound(myFramesWindows)
    Set myFramesWindows(i) = myFPWindow.frames(i)
Next i

i = 0
For i = 0 To UBound(myFramesElements)
    Set myFramesElements(i) = _
        myFPWindow.Document.all.tags("FRAME").Item(i)
Next i

myFSElements(0).frameSpacing = "10"
myFramesElements(0).borderColor = "red"

With myFramesWindows(2).Document
    .bgColor = "green"
    .body.innerHTML = "<p id=""cool""> Added by FP Programmability"
    Set myStyle = .all.cool.style
        myStyle.backgroundColor = "white"
        myStyle.display = False
        myStyle.textDecorationUnderline = True
        myStyle.Font = "Tahoma, 24"
        myStyle.fontStyle = "italic"
End With
End Sub

Changing Meta Tag Content to Another Character Set

You can change all of the content-type META Tags to a different character set (central european) as shown in the following code sample. The current character set is shown in the Language Settings dialog box (available for page properties).

Note The entire content-type META Tag contains a string similar to the following:

content = "text/html; charset = windows-1252"

The character set is "windows-1252" and is the default character set for U.S. English.

Each time the program iterates through the loop, you access the next frame in the frameWindow object, which is the same as accessing each HTML frames tag in succession. However, the Frames collection does not support the For...each construct. You cannot access HTTP-EQUIV type meta tags via their name; you must instead use an index as shown in the following example. The expression beginning with myContentType.Content sets the character set to Central European.

Note FrontPage places the content type in <META> Tag zero(0).

Private Sub ChangeCharSet()
    Dim myFrames As IHTMLFramesCollection2
    Dim myFrame As FPHTMLWindow2
    Dim myHTTPEquiv As String
    Dim myContentType As Object
    Dim myCount As Integer

    Set myFrames = ActivePageWindow.FrameWindow.frames
    Set myFrame = ActivePageWindow.FrameWindow.frames(0)
    myHTTPEquiv = 0

    For myCount = 0 To myFrames.Length - 1
        Set myFrame = myFrames(myCount)
        Set myContentType = _
            myFrame.Document.all.tags("meta").Item(myHTTPEquiv)
        myContentType.content = _
            "text/html; charset=iso-8859-2"
    Next myCount
End Sub


Accessing the Object Model in FrontPage from Design-Time Controls

Some of the content in this topic may not be applicable to some languages.

A design-time control (DTC) is one of a class of ActiveX controls that is exclusively used at design-time as an aid to authoring web content. DTCs function just like embedded wizards—they can be edited to modify the output that the DTC generates on the web page. Once the file is closed, the DTC becomes inactive—the text that the DTC generated has been embedded into the file.

How are design-time controls different from ActiveX controls?

Design-time controls do not contain a binary run-time component, but do have a special interface that provides the ability for the design-time control to persist and generate text. Design-time controls and ActiveX controls can co-exist on the same web page. For more information on DTCs refer to the documentation on the Microsoft workshop Web site for design-time controls.

How do design-time controls differ from Visual InterDev?

FrontPage and Microsoft Visual InterDev are compatible in most areas. For design-time controls, FrontPage provides full access to the Document object model that's available in Microsoft Internet Explorer. The Web object model is also available for design-time controls and provides a rich array of objects, events, methods, and properties. FrontPage also provides support for removing tags (or text) that is inserted into a document by design-time controls.

Properties supported by FrontPage that are not supported by Microsoft Visual InterDev:

  • Preview—returns a string containing the controls preview text.
  • Tag—returns the tag context for the preview string.

Built-in options in Visual InterDev that FrontPage doesn't support:

  • QueryBuilder
  • Data connections
  • Visual InterDev object model for .asp pages

How to access the FrontPage object model from a design-time control

A design-time control is a type of ActiveX control, and thus accesses its host's object model similarly to other controls (see FPHTMLObjectElement object). The design-time control has a UserControl property that returns the UserControl object. This object in turn has an Extender property that returns the environment where the ActiveX control resides. The expression, UserControl.extender returns the environment for the specified DTC.

The Extender property returns FPHTMLObjectElement object and provides access to all of the properties and methods in the FPHTMLObjectElement object. One of these properties is the Document property that accesses the FronptPage Page object model for the document where the design-time control resides. The following statements illustrate how to access the Document property from a DTC.

Dim myDTC As FPHTMLObjectElement
Dim myDoc As DispFPHTMLDocument
Dim myPageWindow As PageWindowEx

Set myDTC = UserControl.Extender
Set myDocument = myDTC.document
Set myPageWindow = myDoc.parentWindow.external

The last Set statement illustrates how to access the Web object model from the Page object model.


Coding in a Windowless Environment

In Microsoft FrontPage, it is possible to create a windowless environment to cut down on User Interface (UI) overhead, but there are some drawbacks to working in such an environment. For example, opening a page with the ViewMode property set to fpPageViewNoWindow, creates a windowless environment where window elements that require the UI won't work correctly. If you open a page without a window and try to access it using code such as PageWindow.Document.ParentWindow, the resulting code returns nothing instead of returning an FPHTMLWindow2 object. The following statements provide access to windowless pages.

Application.LocatePage(DocumentUrl As String, _
    ViewMode As FpPageViewMode) As PageWindowEx
Web.LocatePage(DocumentUrl As String, ViewMode As FPPageViewMode) _
    As PageWindowEx
File.Edit(ViewMode As FpPageViewMode) As PageWindowEx

The following table describes the PageWindowEx methods and properties and the objects or error messages they return. Some methods and properties of the PageWindowEx object are disabled in a windowless environment and will return the results shown in the following table.

Disabled Method or Property of the PageWindow Object | Returned Object or Error Message
ActiveDocument | Returns "object or with variable not set" error message.
ActiveFrameWindow | Returns "object or with variable not set" error message.
Caption | Returns the URL for the PageWindow object.
Document | Returns a Document object.
File | Returns a File object.
ViewMode | This property can not be set. It returns the constant fpPageViewNoWindow.
Visible | Returns False.
Web | Returns the Web object if the object was located using the following statements. Web.LocatePage File.Edit
ApplyTheme | Returns a run-time error.
Close(ForceSave) | Closes the page window.
Refresh(ForceSave) | Refreshes the page window.
Save(ForceOverwrite) | Saves the page window.
SaveAs(ForceOverwrite) | Saves the page window to a new URL.


Modifying Pages Programmatically

This topic illustrates how to work with the DispFPHTMLDocument object elements within the Web object model environment, either to change the contents of a page or simply to access the contents of a page for verification.

Microsoft Visual Basic is a powerful tool that you can use to modify content in your web pages. As you browse through the Object Browser, you'll see many of the same types of components that you're familiar with in Microsoft Internet Explorer.

Tip To only view the programming elements that are compatible with the Page object model of FrontPage, select "FrontPageEditor" as the object library in the Object Browser.

You can access the HTML elements of a page using the ActiveDocument or Document properties that return the document object via the PageWindowEx object. For example, the following statement changes the color of the background for the page in the active page window.

ActivePageWindow.Document.bgColor = "DarkBlue"

The following example checks for a specific hyperlink (index.htm) within the active document. If the hyperlink is found, the procedure exits, but if the hyperlink isn't found, the procedure first checks if the active document is index.htm and, if not, the hyperlink is added at the end of the document.

Private Sub VerifyIndexLink()
    Dim myDoc As DispFPHTMLDocument
    Dim myLinks As Variant
    Dim myLink As Variant
    Dim myNumberOfLinks As Integer
    Dim myAddLink As Boolean
    Dim myLinkName As String
    Dim myLinkName2 As String

    Set myDoc = ActivePageWindow.Document
    Set myLinks = myDoc.Links
    myNumberOfLinks = myLinks.length
    myLinkName = "index.htm"
    myLinkName2 = """" & myLinkName & """"

    For Each myLink In myLinks
        If myLink = myLinkName Then
            myAddLink = True
            Exit For
        End If
    Next

    If myAddLink = False And myDoc.nameProp <> "index" Then
        Call myDoc.body.insertAdjacentHTML("BeforeEnd", "<a href=" _
            & myLinkName2 & ">" & myLinkName & "</a>")
        ActivePageWindow.Save
    End If
    End Sub

Tip Notice that in the last If statement the active page window is saved before exiting the procedure. This would be a good statement to add to the OnPageClose event.


Understanding WebWindows and PageWindows

In Microsoft Internet Explorer, the window object is the root of the object hierarchy. In Microsoft FrontPage, the Application object is the root of the object hierarchy and the WebWindowEx object is an object in the third tier of the object hierarchy belonging to the collection of WebWindows (second tier). The Document property is accessed via the PageWindowEx object (belonging to the collection of PageWindows), whose parent is the WebWindowEx object. The object hierarchy for the WebWindows collection is shown in the following diagram.

WebWindows
WebWindowEx
PageWindows
 PageWindowEx

What is a WebWindowEx object?

The WebWindowEx object is the window container for the web. When you open a web in FrontPage, you see the web in its "web" window. FrontPage opens a new window for each web you open.

What is a PageWindowEx object?

The PageWindowEx object is the container for the web page. When you open a page in a web window, that page is contained in a page window (visible in the right pane). FrontPage opens a new page window for each page you open; however each PageWindowEx object is contained within the WebWindowEx object for the individual web. Each page that you've opened is visible on the Windows menu in FrontPage.

Where does the DispFPHTMLDocument object fit in?

The DispFPHTMLDocument object contains the HTML elements for a page. The elements for the document are available using an expression such as ActivePageWindow.Document.element where element is one of the HTML elements available in FrontPage.


Managing Publishing with MetaTags

Automate publishing your web by using a combination of events such as OnBeforeWebPublish and meta data that can be obtained by accessing the data in the Properties collection. For example, before publishing a web, you might want to check the meta data for all of the pages in the web. To check if Microsoft FrontPage generated all of the pages in your web, use the following code in the OnBeforeWebPublishing event, along with an event handler.

Private Sub CheckIfFP()
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myMetaTags As MetaTags
    Dim myMetaTag As Variant

    Set myFiles = ActiveWeb.RootFolder.Files

    For Each myFile In myFiles
        Set myMetaTags = myFile.MetaTags
        'Check for any text files.
        If myMetaTags.Count = 0 And _
            myFile.Extension <> ".asa" Then
            MsgBox myFile.Name & " was not generated by FrontPage."
        End If
        'Check all web pages.
        For Each myMetaTag In myMetaTags
            If myMetaTag = "generator" Then
              If myFile.Properties("vti_generator") = _
                "Microsoft FrontPage 4.0" Then
                Exit For
              Else
                MsgBox myFile.Name & " was not generated by FrontPage."
              End If
            End If
        Next
    Next
End Sub

You can also check the value of the vti_donotpublish property key before publishing. If the document is a draft or a document that isn't to be published, the vti_donotpublish property key will be set to True. The following example checks the value of the vti_donotpublish property key.

Dim myFiles As WebFiles
Dim myFile As WebFile

For Each myFile In myFiles
    If myFile.Properties("vti_donotpublish") = True Then
        MsgBox "Do not publish " & myFile.Name
    End If
Next

The vti_donotpublish property key can be used to disable publishing. When publishing is complete, the file will not be published to the server. The following example disables publishing for the first file in the Files collection.

Sub PublishThisFile(myFileName As String, myStatus As Boolean)
Dim myFile As WebFile

Set myFile = ActiveWeb.LocateFile(myFileName)

Call myFile.Properties.Add("vti_donotpublish", Not (myStatus))
myFile.Properties.ApplyChanges
End Sub

Private Sub PublishFile()
PublishThisFile Activeweb.RootFolder.Files(0), False
End Sub


Programming Dynamic Elements in Microsoft FrontPage

The objects, methods, and properties in Microsoft Internet Explorer are usually designed for run-time use. In Microsoft FrontPage, most of the elements are designed for design-time only. You can programmatically add content to an existing document, access selections on a page, create a scripting element, or modify an existing table. Click one of the following links to move directly to that subject.

Adding Content to a Document Using a TextRange

Accessing User Selections Using a TextRange

Creating a Scripting Element

Accessing Tables

Adding Content to a Document Using a TextRange

You can programmatically add HTML content to a web page by creating a text range object and adding the new content to the page as shown in the following example. The text range object is created from the myDocument body object. If the value in myClearPage is true, then the entire content between the <Body></Body> tags is replaced with the new HTML content, otherwise the new content is appended to the original content.

Public Function AddHTMLToPage(myDocument As Object, _
    myHTMLText As String, myClearPage As Boolean) As Boolean
    Dim myRange As Object
    Dim myBodyText As Object

    On Error GoTo CannotAddHTML

    'Create a TextRange object
    If myClearPage Then
        Set myRange = _
            myDocument.all.tags("BODY").Item(0).createTextRange
        'Clear the current document
        Call myRange.pasteHTML("")
        myRange.collapse False
        Set myRange = Nothing
    End If

    Set myBodyText = myDocument.all.tags("BODY").Item(0)
    myBodyText.innerHTML = myBodyText.innerHTML & myHTMLText & vbCrLf

    AddHTMLToPage = True
    Exit Function

     CannotAddHTML:
    AddHTMLToPage = False
End Function

Sub AddNewHTML()
    Dim myHTMLString as String
    Dim myBodyElement As Object

    myHTMLString = "<B> <I> New Sale on Vintage Wines! </I> </B>" & vbCr

    If AddHTMLToPage(ActivePageWindow.Document, myHTMLString, True) Then
        Set myBodyElement = _
          ActivePageWindow.Document.all.tags("BODY").Item(0)
    End If
End Sub

Accessing User Selections Using a TextRange

You can use the IHTMLTxtRange object to select HTML objects or manipulate a user selection on a specified document. The following example applies a background color to the current selection.

Private Sub ApplyStyleToSelection()
    Dim myRange As IHTMLTxtRange

    Set myRange = ActiveDocument.selection.createRange

    myRange.parentElement.style.backgroundColor = "SkyBlue"
End Sub

Adding Script to a Page

Scripting in Visual Basic for FrontPage 2000 is easy. Just load the script into a string variable and append the string to the <Head> tag for the page. (The <Head> tag is accessed using an IHTMLElement object). Once the string has been added to the page, it is a valid scripting element and can be accessed through the FPHTMLScriptElement object and modified. The following code adds a script element to the current page, verifies that the script was added, adds a query to the user with OK and Cancel buttons, and then prints some of the script element properties in the Immediate window of the Visual Basic Editor.

Private Sub CreateAScript()
    Dim myScriptElement As FPHTMLScriptElement
    Dim myHTag As IHTMLElement
    Dim myBodyTag As IHTMLElement
    Dim myBodyString As String
    Dim myHTMLString As String
    Dim myText As String

    'Build a script tag construct.
    myHTMLString = myHTMLString & "<script language=""VBScript"">" _
      & vbCrLf
    myHTMLString = myHTMLString & "Function doOK" & vbCrLf
    myHTMLString = myHTMLString & _
      "msgbox ""Please wait, an order form is being generated...""" & _
      vbCrLf
    myHTMLString = myHTMLString & "End Function" & vbCrLf & vbCrLf
    myHTMLString = myHTMLString & "Function doCancel" & vbCrLf
    myHTMLString = myHTMLString & _
      "msgbox ""Exiting ordering process.""" & vbCrLf
    myHTMLString = myHTMLString & "End Function" & vbCrLf
    myHTMLString = myHTMLString & "</script>" & vbCrLf

    'Build a call tag construct.
    myBodyString = "<CENTER>" & vbCrLf
    myBodyString = myBodyString & _
      "<BUTTON onclick=""doOK()"">OK</BUTTON>" & vbTab
    myBodyString = myBodyString & _
      "<BUTTON onclick=""doCancel()"">Cancel</BUTTON>" & vbCrLf
    myBodyString = myBodyString & "</CENTER>"

    'Add text to the document
    myText = "I'd like to order some vintage wines."

    'Access the <HEAD> tag.
     Set myHTag = ActivePageWindow.Document.all.tags("HEAD").Item(0)

    'Append the script element to the <Head> tag(myHTag).
    myHTag.innerHTML = myHTag.innerHTML & myHTMLString

    'Verify that the script element was added.
    If ActivePageWindow.Document.scripts.length = 1 Then
        'Access the script element just added.
        Set myScriptElement = ActivePageWindow.Document.scripts(0)

        'Print script element properties to the Immediate window.
        'JScript only: the next statement gets the FOR= attribute from
        'the JScript, otherwise an empty string prints in the Immediate
        'window.
        Debug.Print myScriptElement.htmlFor

        'Retrieve the content of the script.
        Debug.Print myScriptElement.outerHTML

        'Check scripting language.
        Debug.Print myScriptElement.language
    End If

    'Add a query to the user and call the script element.
    ActiveDocument.body.insertAdjacentHTML "BeforeEnd", _
      "<B><I>" & myText & "</B></I><P>" & myBodyString
End Sub

Accessing Tables

Anyone who has created tables and worked with their contents in HTML will find it easy to use Visual Basic to access tables. The following program accesses a table on the current page and inserts a cell.

Sub AccessTables()
    Dim myTable As FPHTMLTable
    Dim myRow As FPHTMLTableRow
    Dim myCell As FPHTMLTableCell

    'Get the table.
    Set myTable = ActiveDocument.all.tags("TABLE").Item(0)

    'Get the first row.
    Set myRow = myTable.rows(0)
    MsgBox myRow.cells.Length

    'Get the first cell.
    Set myCell = myRow.cells(0)
    MsgBox myCell.Width

    'Add a new cell to the first row.
    Set myCell = myTable.rows(0).insertCell(myRow.cells.Length)
End Sub


Using Events to Control Actions

There are two types of events in Microsoft FrontPage, events that are driven off the Application object model and events that are driven off the Page object model. The events for the Application object model can be used to control under what conditions a web is published, whether you want to save a page whenever the OnPageClose event is fired, or whether you want to set styles, fonts, or backgrounds whenever a new page is created. For more information on the Application object model events, click one of the events in the following list.

OnAfterPageSave | OnPageNew
OnBeforePageSave | OnPageOpen
OnAfterWebPublish | OnWebClose
OnBeforeWebPublish | OnWebNew
OnAfterPageWindowViewChange | OnPageWindowActivate
OnAfterWebWindowSubViewChange | OnRecalculateHyperlinks
OnAfterWebWindowViewChange | OnWebFileCheckOut
OnBeforePageWindowViewChange | OnWebOpen
OnBeforeWebWindowSubViewChange | OnPageClose

In the Microsoft Internet Explorer DHTML object model, event handlers are created using one of the following methods:

  • Create a procedure or function within a script tag
  • Use a FOR= attribute inside a script tag
  • Use FrontPage events and class modules

You can declare an event handler function by creating a procedure or function inside a script tag and then define an "On*" attribute that calls that procedure for the element you that you want to generate the events. For example, to catch a mouse click on an anchor you could use the HTML code shown in the following example.

<html>
<head>
<script language="VBScript">
sub test
msgbox "You clicked"
End Sub
</script>
</head>
<body>
<a href="CatchMouse.htm" onclick="CatchMe"> This is an anchor, click here</a>
</body>
</html>

Another way to declare event handling code is to create a script tag with a FOR=attribute, as shown in the following example.

<SCRIPT FOR=myanchor EVENT=onclick LANGUAGE="VBScript">
msgbox "You Clicked"
</SCRIPT>
<a id="myanchor" href="CatchMouse.htm" onclick="CatchMe">this is an anchor, click on it </a>

However, in the FrontPage Page object model, you're programming with events and objects that are compatible with Internet Explorer, but for use at designtime. To program events for runtime, you can use the standard Microsoft Visual Basic 5.0 (or higher) keywords to access the Page object model events just as you would to access the Web object model events. This method combines the two techniques described previously. The following example catches the OnClick event for a hyperlink in FrontPage.

In the Visual Basic Editor, insert a class module and name it CatchOnClick. Add the following code to the class module.

Dim WithEvents eAnchor As FPHTMLAnchorElement
Dim WithEvents eDoc As FPHTMLDocument
Dim e As IHTMLEventObj

Private Sub Class_Initialize()
Set eDoc = ActiveDocument
Set eAnchor = eDoc.links(0)
End Sub

Private Function eAnchor_onclick() As Boolean
Set e = eAnchor.Document.parentWindow.event
If (MsgBox("OnClick Event for " & e.srcElement.tagName & _
    " would you like to cancel the event bubbling?", _
    vbYesNo) = vbYes) Then
    e.cancelBubble = True
    e.returnValue = False
Else
    e.cancelBubble = False
    e.returnValue = True
End If
End Function

Private Function eDoc_onclick() As Boolean
MsgBox "OnClick event for the Document object"
End Function

Next add a standard module and add the following code.

Public e As CatchOnClick
Sub GetClick()
Set e = New CatchOnClick
End Sub

Note To run the example, perform the following steps:

  • Add a hyperlink to a page in FrontPage
  • Run the GetClick procedure to create a global instance of the CatchOnClick event handler class
  • Click the hyperlink

A prompt is displayed stating that the OnClick event fired. The prompt also queries the user— about whether the program should pass the event on up the event chain? If Yes is chosen, the OnClick event is passed up to the document object to be handled.

To control which document object the event is passed to, you must set both the cancelBubble and returnValue events. The cancelBubble event works to cancel the event from going any farther up the event chain. Set the cancelBubble property of the IHTMLEventObject to True when you don't want the OnClick event to be passed up to the next level of OnClick events, otherwise, set the cancelBubble property to False. For example, if you have an image that has an OnClick event placed on a document, which also has an OnClick event, you would set the cancelBubble property for the IHTMLEventObj object to True for the image, if you don't want the OnClick event to be passed on up to the document OnClick event.

The returnValue property is used to control the default action taken by FrontPage when an event fires. Using the previous example of an image placed on a document, if the returnValue property for the IHTMLEventObject for the image is set to False in the OnClick event, then the shortcut menu would be disabled (because the right-click context menu is the default action for the OnClick event).


Managing Source Control Projects in Microsoft FrontPage

Microsoft FrontPage provides two methods of versioning, FrontPage Light Weight source control (also known as Microsoft Office-style locking or FrontPage-based locking) and Microsoft Visual SourceSafe. FrontPage Light Weight source control is the default versioning method for source control projects in FrontPage.

Versioning provides a measure of control over users who maintain pages on your Web sites. Both source control methods provide checkin, checkout, undocheckout. Visual SourceSafe provides other versioning capabilities, such as version tracking and rollback features.

Creating a source control project

To create a new source control project, you set the RevisionControlProject property to the path of the project (for Visual SourceSafe) or to <FrontPage-based Locking> as shown in the following statement.

ActiveWeb.RevisionControlProject = "<FrontPage-based Locking>"

Assuming that the string "$/Rogue Cellars" is a valid Visual SourceSafe project, the following statement assigns the active web to a Visual SourceSafe project.

ActiveWeb.RevisionControlProject = "$/Rogue Cellars/Inventory"

The following example creates a source control project and checks out two files.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). You may create two files called "index.htm" and "footnote.htm" or substitute file names of your choice.

Private Sub CreateSourceControl()
    Dim myWeb As WebEx
    Dim myProject As String
    Dim myFile1 As WebFile
    Dim myFile2 As WebFile

    Set myWeb = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    Set myFile1 = myWeb.RootFolder.Files("index.htm")
    Set myFile2 = myWeb.RootFolder.Files("footnote.htm")

    myProject = "<FrontPage-based Locking>"

    myWeb.RevisionControlProject = myProject
    myFile1.Checkout
    myFile2.Checkout
End Sub

The Checkout method provides a Boolean force checkout argument for administrators.

Removing a source control project

Once a project is completed, you may decide to remove versioning. To do this, set the RevisionControlProject property to an empty string ("") as shown in the following statement.

myWeb.RevisionControlProject = ""

Switching between FrontPage Light Weight and Visual SourceSafe projects

To switch between these two types of versioning, you must first set the RevisionControlProject property to an empty string ("") as shown in the following statement.

myWeb.RevisionControlProject = ""


Application Object

Application
Multiple objects

Represents the Microsoft FrontPage application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a document object that references the FrontPage Page object model that is compatible with Microsoft Internet Explorer 4.0 and later.

Using the Application Object

Use the Application property to return the Application object. You can use the Application property from any of the objects in FrontPage. The following example checks the current user’s logon and sets appropriate security settings from the active WebEx object. It assumes a procedure named CheckUserName already exists.

Private Sub GetLogonName()
    Dim myWeb As WebEx
    Dim currLogonName As String
    Dim userSecurityLevel As Integer

    Set myWeb = ActiveWeb
    CurrentLogonName = myWeb.Application.UserName

    If CurrentLogonName = “Guest” then
        userSecurityLevel = 10
    Else
        Call CheckUserName(currLogonName)
    End If
End Sub

Many of the properties and methods that return the most common user-interface objects, such as the ActiveDocument property, can be used without the Application object qualifier. For example, instead of writing Application.ActiveDocument.Title, you can write ActiveDocument.Title. Properties and methods that can be used without the Application object qualifier are considered "global." To view global properties and methods in the Object Browser, click <globals> at the top of the list in the Classes box of the Object Browser.

Remarks

To use Automation to control FrontPage from another application, use the CreateObject or GetObject function to return a FrontPage Application object. The following Microsoft Word Visual Basic for Applications example starts FrontPage, opens an existing web, and closes the web.

Private Sub StartFrontPage()
    Dim myNewFP As Variant

    Set myNewFP = CreateObject("FrontPage.Application")
    myNewFP.Webs.Open ("C:\MyWebs\Adventure Works")
    myNewFP.Webs.Close "(C:\MyWebs\Adventure Works")
    Set myNewFP = Nothing
End Sub


BasicList Object

BasicList
Multiple objects

Contains information about the basic list type used within Microsoft FrontPage. The BasicList object allows users to share and categorize information between webs.

Using the BasicList object

Use Lists.item(index), where index is either the name of the basic list or its numeric position within the collection, to return a single Basic List object. The following example displays the names of all basic lists in the active web. If the web contains no lists, a message is displayed to the user.

Sub ListAllLists()
'Displays the names of all basic lists in the collection

    Dim lstWebList As List
    Dim strName As String
    Dim blnFound As Boolean

    'Set found flag to false
    blnFound = False
    'Check if any lists exist and, if so cycle through them
    If Not ActiveWeb.Lists Is Nothing Then
        For Each lstWebList In ActiveWeb.Lists
            If lstWebList.Type = fpListTypeBasicList Then
                'Set boolean flag to found and names to string
                blnFound = True
                If strName = "" Then
                    strName = lstWebList.Name & vbCr
                Else
                    strName = strName & lstWebList.Name & vbCr
                End If
            End If
        Next
        If blnFound = True Then
            'Display names of all basic lists
            MsgBox "The names of all basic lists in the current web are:" _
                   & vbCr & strName
        Else
            MsgBox "There are no basic lists in the current web."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub

Use the Lists collection's Add method to create a new list of type fpListTypeBasicList. The following example creates a new list called NewShare.

Sub NewList()
'Adds a new list to the current web

    Dim objApp As FrontPage.Application
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists
    'Add new list and displays a message to the user.
    objLists.Add Name:="NewShare", _
                 ListType:=fpListTypeBasicList, _
                 Description:="List of Shared files"

    MsgBox "A new list was added to the Lists collection."

End Sub


DispFPHTMLDocument Object

Multiple objects
DispFPHTMLDocument
WebEx

Represents the HTML document in the current window. The DispFPHTMLDocument object contains all property information related to the HTML page such as background color, link color and style sheet as well as methods that act on the data such as the CreateElement and ExecCommand methods.

Using the DispFPHTMLDocument object

To access the DispFPHTMLDocument object, use the ActiveDocument property of either the Application object or the PageWindowEx object. The following example returns the active document in the current application.

Set objDoc = objApp.ActiveDocument

Use the PagewindowEx object's Document property to return the HTML document currently in the page window. The following example returns the current DispFPHTMLDocument, modifies its background color and displays its title.

Sub Document()
'Returns the active HTML document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objPgeWdw As PageWindowEx
    Set objApp = FrontPage.Application
    'Create reference to active page window
    Set objPgeWdw = objApp.ActivePageWindow
    'Create reference to open document
    Set objDoc = objPgeWdw.Document

    With objDoc
        'Display title and change background color
        MsgBox .Title
        .bgColor = "FFFFFF"
    End With
End Sub


DocumentLibrary Object

DocumentLibrary
Multiple objects

Represents the collection of documents in the current web.

Using the DocumentLibrary object

Use Lists.Item(index), where index is either the name of the document library or its numeric position within the collection, to return a single DocumentLibrary object. The following example displays the names of all document libraries in the active web. If the web contains no document libraries, a message is displayed to the user.

Sub ListAllLibraries()
'Displays the names of all document libraries
'in the collection.

    Dim lstWebList As List
    Dim strName As String
    Dim blnFound As Boolean

    'Set found flag to false
    blnFound = False
    'Check if any lists exist and is so, cycle through them
    If Not ActiveWeb.Lists Is Nothing Then
        For Each lstWebList In ActiveWeb.Lists
            If lstWebList.Type = fpListTypeDocumentLibrary Then
                'Set boolean flag to found and add name to string
                blnFound = True
                If strName = "" Then
                    strName = lstWebList.Name & vbCr
                Else
                    strName = strName & lstWebList.Name & vbCr
                End If
            End If
        Next
        If blnFound = True Then
            'Display names of all document libraries
            MsgBox "The names of all document libraries in the current web are:" _
                   & vbCr & strName
        Else
            MsgBox "There are no document libraries in the current web."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub

Use the List object's Add method to create a new list of type fpListTypeDocumentLibrary. The following example creates a new document Library called Newlibrary.

Sub NewLibrary()
'Adds a new list to the current web

    Dim objApp As FrontPage.Application
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists
    'Add new list
    objLists.Add Name:="NewLibrary", _
                 ListType:=fpListTypeDocumentLibrary, _
                 Description:="List of Shared files"

    'Display message to user
    MsgBox "A new library was added to the Lists collection."

End Sub


List Object

Multiple objects
List
Multiple objects

Contains information about the List object and the Microsoft FrontPage collaboration objects. The List object is a base class that defines the common members used by the different types of lists in FrontPage. For example, the collaboration objects, — the BasicList, DocumentLibrary, and Survey objects — allow information to be shared and exchanged between different users and different webs. The List object is a member of the Lists collection.

Using the List object

Use Lists.Item(index), where index is either the name of the list or its numeric position within the collection, to return a single List object. The following example displays the names of all lists in the active web. If the web contains no lists, a message is displayed to the user.

Sub ListAllLists()
'Displays the names of all lists in the collection

    Dim lstWebList As List
    Dim strName As String

    'Check if any lists exist
    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists
        For Each lstWebList In ActiveWeb.Lists
            'add list names to string
            If strName = "" Then
                strName = lstWebList.Name & vbCr
            Else
                strName = strName & lstWebList.Name & vbCr
            End If
        Next
        'Display names of all lists
        MsgBox "The names of all lists in the current web are:" _
               & vbCr & strName
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub

Similarly, use the WebFolder object's List property to return the List object associated with the folder.

Use the List object's Fields property to return a collection of ListField objects that define the fields in the current list.


ListField Object

Multiple objects
ListField

Contains information about the fields that make up a List object. The fields of a list define the columns that appear in the list and present information about the items in the list. The ListField object is a base class that defines the common members used by the different types of fields in Microsoft FrontPage lists.

Using the ListField object

Use ListFields.Item(index), where index is the either name of the field or it's position within the collection to return a single ListField object. The following example displays the names of all fields in the current list. If the web contains no lists, a message is displayed to the user.

Sub ListAllFields()
'Displays the name of fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application

    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            If strType = "" Then
                'Create new string
                strType = objField.Name & vbCr
            Else
                'Add next field name to string
                strType = strType & objField.Name & vbCr
            End If
        Next objField
        MsgBox "The names of the fields in this list are: " & _
                vbCr & strType
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


ListFieldChoice Object

ListFieldChoice

Contains information about the choice field. The choice field allows the user to select from a specified number of options by providing a drop-down list or radio buttons in the list.

Using the ListFieldChoice object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpFieldChoice to return a single ListFieldChoice object.

Use the ListFields.Add method to add a field of type fpFieldChoice to the ListFields collection. The following example adds a new field named NewChoiceField of type fpFieldChoice, to the ListFields collection. Use the AddChoice method to add choices to the list. Use the clear method to clear the choices from the list.

Sub DisplayChoice()
'Display choice

    Dim objApp As FrontPage.Application
    Dim objLstFlds As listFields
    Dim objFldChoice As ListFieldChoice
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewChoiceField"
    'Add new field of type fpFieldChoice to list
    objLstFlds.Add Name:=strName, Description:="New Choice value Field", _
                   Fieldtype:=fpFieldChoice, Required:=True

    MsgBox "A new Field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFieldComputed Object

ListFieldComputed

Contains information about fields created automatically by the computer. The ListFieldComputed object cannot be created by the user and instead is used by Microsoft FrontPage to create a reference from the list to a page in the web. For example, in many lists, the Title field is created by the computer and is used to reference the page corresponding to the list field.

Using the ListFieldComputed object

Use ListFields.Item(index) to return a ListFieldComputed object, where index is either the name of the field or its numeric position within the collection. The following example displays the names of all computed fields in the current list.

Sub ListComputedFields()
'Display the names of computed fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field
            If objField.Type = fpFieldComputed Then
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        MsgBox "The names of the fields in this list are: " & _
                vbCr & strType
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


ListFieldCounter Object

ListFieldCounter

Contains information about the key counter used within the list.

Remarks

This field is created automatically by Microsoft FrontPage and cannot be modified by the user.

Using the ListFieldCounter object

The following example displays the name associated with the counter field in the current list.

Sub ListCounterFields()
'Displays the name of counter fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String
    Dim blnFound As Boolean

    blnFound = False
    Set objApp = FrontPage.Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field of type fpFieldFile
            If objField.Type = fpFieldCounter Then
                blnFound = True
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        If blnFound = True Then
            MsgBox "The names of the fields in this list are: " & _
                    vbCr & strType
        Else
            MsgBox "There are no counter fields in the list."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


ListFieldCurrency Object

ListFieldCurrency

Contains information about the field type used to view currency information within the list. The ListFieldCurrency object allows you to view information about different currency types within the currency field of the list.

Using the ListFieldCurrency object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpListFieldCurrency, to return a single ListFieldCurrency object.

Use the ListFields.Add method to add a field of type fpFieldCurrency to the ListFields collection. The following example adds a new field named NewCurrencyField of type fpFieldCurrency to the ListFields collection and changes the currency type to display Canadian dollars.

Sub CreateCurrencyField()
'Add new Currency field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim objFldChoice As ListFieldCurrency
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewCurrencyField"
    'Add new Field of type fpFieldCurrency to list
    objLstFlds.Add Name:=strName, Description:="New Currency Field", _
                   Fieldtype:=fpFieldCurrency, Required:=True
    Set objFldChoice = objLstFlds.Item("NewCurrencyField")
    'Change currency type to Canadian
    objFldChoice.Currency = fpCurrencyFieldCanada
    MsgBox "A new Field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFieldDateTime Object

ListFieldDateTime

Contains information about the field used to display dates and times within a FrontPage list. The ListFieldDateTime object allows you to view date and time information in a variety of different configurations depending on the type of data in the list.

Using the ListFieldDateTime object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpListFieldDateTime, to return a single ListFieldDateTime object.

Use the ListFields.Add method to add a field of type fpListFieldDateTime to the ListFields collection. The following example adds a new field named NewDateTimeField of type fpListFieldDateTime to the ListFields collection.

Sub CreateDateTimeField()
'Add new Date/Time field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewDateTimeField"
    'Add new Field of type fpFieldDateTime to list
    objLstFlds.Add Name:=strName, Description:="New Date Time Field", _
                   Fieldtype:=fpFieldDateTime, Required:=True
    MsgBox "A new Field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFieldFile Object

ListFieldFile

Contains information about any files contained in the list.

Remarks

This field is created automatically by Microsoft FrontPage and cannot be modified by the user.

Using the ListFieldFile object

The following example displays the names of all fields of type fpFieldFile in the active list. If no fields of this type exist, or if the web contains no lists, a message is displayed to the user.

Sub ListFileFields()
'Displays the name of file fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String
    Dim blnFound As Boolean

    blnFound = False
    Set objApp = FrontPage.Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field of type fpFieldFile
            If objField.Type = fpFieldFile Then
                blnFound = True
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        If blnFound = True Then
            MsgBox "The names of the fields in this list are: " & _
                    vbCr & strType
        Else
            MsgBox "There are no file fields in the list."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


ListFieldInteger Object

ListFieldInteger

Contains information about fields created automatically by the computer. The ListFieldinteger object cannot be created by the user and instead is used by Microsoft FrontPage to create an ID for each item in the list. For example, in a typical list, the ID field is created by the computer as a unique identifier for each item in the list.

Using the ListFieldInteger object

Use ListFields.Item(index) to return a ListFieldInteger object, where index is either the name of the field or its numeric position within the collection. The following example displays the names of all integer fields in the current list. If the web contains no lists, or if the list contains no Integer fields, a message is displayed to the user.

Sub ListIntegerFields()
'Displays the name of Integer fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String
    Dim blnFound As Boolean

    blnFound = False
    Set objApp = FrontPage.Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field of type fpFieldInteger
            If objField.Type = fpFieldInteger Then
                blnFound = True
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        If blnFound = True Then
            MsgBox "The names of the fields in this list are: " & _
                    vbCr & strType
        Else
            MsgBox "There are no Integer fields in the list."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


ListFieldLookup Object

ListFieldLookup
ListField

Contains information about the Lookup field. The ListFieldLookup object allows you to search for information within the given web based on a specified field.

Using the ListFieldLookup object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpFieldLookup, to return a single ListFieldLookup object.

Use the ListFields.Add method to add a field of type ListFieldLookup to the ListFields collection.

The following example adds a new field named NewFileLookupField of type fpFieldLookup to the ListFields collection.

Sub CreateLookup()
'Add new Lookup field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim objFldLookup As ListFieldLookup
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewFileLookupField"
    'Add new Field of type fpFieldLookup to list
    objLstFlds.Add Name:=strName, Description:="New Lookup Field", _
                   Fieldtype:=fpFieldLookup
    Set objFldLookup = objLstFlds.Item("NewFileLookupField")
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFieldMultiLine Object

ListFieldMultiLine

Contains information about the field used to display information containing more than one line of text. For example, the ListFieldMultiLine object can be used to display descriptions and summaries, which often require more than a single line.

Using the ListFieldMultiLine object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpFieldMultiLine, to return a single ListFieldMultiLine object.

Use the ListFields.Add method to add a field of type fpFieldMultiLine to the ListFields collection.

The following example adds a new field named Description of type fpFieldMultiLine to the ListFields collection. The subroutine displays the name of the new field as well as the number of lines it will contain.

Sub CreateMultiLine()
'Add new MultiLine Field
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim objLstFldMulti As ListFieldMultiLine
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "Description"
    'Add new Field of type fpFieldMultiLine to list
    objLstFlds.Add Name:=strName, Description:="Description Field", _
                   Fieldtype:=fpFieldMultiLine
    Set objLstFldMulti = objLstFlds.Item(strName)
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & ". It contains " & _
           objLstFldMulti.NumberOfLines & " lines."

End Sub


ListFieldNumber Object

ListFieldNumber

Contains information about how numbers are displayed in Microsoft FrontPage list fields. The ListFieldNumber object allows you to configure the way in which you view numbers in FrontPage lists.

Using the ListFieldNumber object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpFieldNumber, to return a single ListFieldNumber object.

Use the ListFields.Add method to add a field of type fpFieldNumber to the ListFields collection. The following example adds a new field named Total of type fpFieldNumber to the ListFields collection. The subroutine displays the name of the new field and the name of the list to which it was added.

Use the ListFieldNumber object's DisplayFormat property to change the way in which the data will be displayed in the field.

Sub CreateNumberField()
'Add new MultiLine Field
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "Total"
    'Add new Field of type fpFieldNumber to list
    objLstFlds.Add Name:=strName, Description:="Numeric Total Field", _
                   Fieldtype:=fpFieldNumber
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFields Collection

Multiple objects
ListFields
ListField

Represents a collection of ListField objects that define the text fields used within Microsoft FrontPage lists. The ListField object is a base class that defines the common members used by the different types of fields in FrontPage. For example, the ListFieldCurrency and ListFieldNumber objects allow you to customize the way in which currency and numeric information is displayed.

Using the ListFields collection

Use Fields .Item(index), where index is either the name of the list or its position within the collection, to return a single ListField object. The following example displays the names of all fields in the first list of the active web. If the web contains no lists, a message is displayed to the user.

Use the Add method to add a new ListField object to the ListFields collection.

Sub ListFields()
'Display the names of fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            If strType = "" Then
                'Create new string
                strType = objField.Name & vbCr
            Else
                'Add next field name to string
                strType = strType & objField.Name & vbCr
            End If
        Next objField
        MsgBox "The names of the fields in this list are: " & _
                vbCr & strType
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


ListFieldSingleLine Object

ListFieldSingleLine

Contains information about the single line field. The fpFieldSingleLine object is used to display information that typically requires no more than a single line of text. For example, the Name and Title fields typically use the ListFieldSingleLine object to display information.

Using the ListFieldSingleLine object

The following example creates a new field of type ListFieldSingleLine named Alternative Name. The subroutine displays the name of the new field and the name of the list to which it was added.

Sub CreateSingleLineField()
'Add new SingleLineField
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "Alternative Name"
    'Add new Field of type fpFieldSingleLine to list
    objLstFlds.Add Name:=strName, Description:="Numeric Total Field", _
                   Fieldtype:=fpFieldSingleLine
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFieldTrueFalse Object

ListFieldTrueFalse

Contains information about the Boolean true/false field in a Microsoft FrontPage list. The ListFieldTrueFalse object allows you to provide the user with a simple, binary user-interface option.

Using the ListFieldTrueFalse object

The following example creates a new field of type fpFieldTrueFalse named Default Page. The subroutine displays the name of the new field and the name of the list to which it was added.

Sub CreateTrueFalseField()
'Add new TrueFalse field
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "Default Page"
    'Add new Field of type fpFieldTrueFalse to list
    objLstFlds.Add Name:=strName, Description:="Determines if this is " & _
     "default page", Fieldtype:=fpFieldTrueFalse
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


ListFieldURL Object

ListFieldURL

Contains information about the Microsoft FrontPage field used to display URLs. The ListFieldURL object allows you to customize the way URLs appear in the list fields. The URL can be displayed as an image or as a link. Use the DisplayFormat property to change the view settings.

Using the ListFieldURL object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpField URL, to return a single ListFieldURL object.

The following example creates a new field of type fpFieldURL and displays the name of the new field and the name of the list into which it was inserted.

Sub CreateURLField()
'Add new URL field
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "Location"
    'Add new Field of type fpFieldURL to list
    objLstFlds.Add Name:=strName, Description:="Displays file locations", _
                   Fieldtype:=fpFieldURL
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


Lists Collection

WebEx
Lists
List

Represents the collection of all List objects in the current web. Lists allow information to be shared and exchanged between different users and different webs.

Using the Lists collection

Use the Lists property of the WebEx object to return the collection of all lists in the web. Use Lists.item(index), where index is the either name of the list or its numeric position within the collection to return a single List object.

The following example displays the names of all lists in the active web. If the active web does not contain any lists, a message is displayed to the user.

Sub ListAllLists()
'Displays the names of all lists in the collection

    Dim lstWebList As List
    Dim strName As String

    'Check if any lists exist
    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists
        For Each lstWebList In ActiveWeb.Lists
            'add list names to string
            If strName = "" Then
                strName = lstWebList.Name & vbCr
            Else
                strName = strName & lstWebList.Name & vbCr
            End If
        Next
        'Display names of all lists
        MsgBox "The names of all lists in the current web are:" _
               & vbCr & strName
    Else
        'Other wise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub

Use the Lists.Add method to add a new list to the Lists collection. The following example adds a new list of type fpBasicList called NewShare to the active web.

Sub NewList()
'Adds a new list to the current web

    Dim objApp As FrontPage.Application
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists
    'Add new list
    objLists.Add Name:="NewShare", _
                 ListType:=fpListTypeBasicList, _
                 Description:="List of Shared files"

    'Display message to user
    MsgBox "A new list was added to the Lists collection."

End Sub


MetaTags Collection Object

WebFile
MetaTags

An array of property key/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 property key/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:

  • Set the DisableMetaTagStore key on a per-service basis
  • Set the DisableMetaTagStore key as a global setting under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\All Ports
  • Set the vti_disablemetatagstore property

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 the 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 then copy the example into the code window.

Private Sub cmdGetMetaTagInfo_Click()
Dim myWeb As WebEx
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 property key value as a string, of an item in the MetaTags collection to return the property key/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 property key 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


NavigationNode Object

Multiple objects
NavigationNode
Multiple objects

Represents a node in the navigation structure of a web. The NavigationNode object is a member of the NavigationNodes collection. Within the NavigationNodes collection, individual NavigationNode objects are indexed beginning with zero.

Important From the NavigationNode object, you can access all other navigation nodes in a web. The RootNavigationNode object, created by default each time you create a new web, provides the basis for the navigation structure, which is accessed through the Children property. The first child node of the navigation structure is usually the home page of the web, which can be accessed through the HomeNavigationNode property. However, the first child node of the root navigation node can be any page, and may not contain a HomeNavigationNode object at all.

Using the NavigationNode Object

You can use the NavigationNode property to return the NavigationNode object. The following example builds a list of navigation node labels for the WebFile object of the WebFiles collection.

Private Sub GetNavigationNode()
Dim myWeb As WebEx
Dim myWebFiles As WebFiles
Dim myWebFile As WebFile
Dim myNavNodeLabel As String
Dim myLabel As String

On Error Resume Next

Set myWeb = ActiveWeb
Set myFiles = myWeb.RootFolder.Files

With myFiles
    For Each myFile In myFiles
        myLabel = myFile.NavigationNode.Label
        If Err <> 0 Then Exit Sub
        myNavNodeLabel = myNavNodeLabel & myLabel & vbCRLF
    Next
End With
End Sub

The Children property returns the collection of child nodes within the navigation structure of a web. The following statement returns the number of child nodes within the navigation structure of the active web.

myNavChildrenCount _
    = ActiveWeb.RootFolder.Files(0).NavigationNode.Children.Count

Use Children(index), where index is the index number of a navigation node item, to return a single NavigationNode object. The following statement returns the file name of the first navigation node in the NavigationNodes collection.

myNavNodeName _
    = ActiveWeb.RootFolder.Files(0).NavigationNode.Children(0).File.Name

The File property returns the File object that is associated with the NavigationNode object. The following statement returns True if the file is open.

myNavFile = ActiveWeb.RootFolder.Files(3).NavigationNode.File.IsOpen

The Home property returns the Home object associated with the current navigation node and references information such as the Children, File, Label, Next, Prev, and other properties for the home page. The following statement returns the URL of the Home property for the NavigationNode object.

myHomePageUrl _
    = ActiveWeb.RootFolder.Files(5).NavigationNode.Home.Url

You can return the Label property to set or return text that can be used as buttons within the navigation structure, or used for text in a navigation bar. The following example returns the label for the home page.

myLabel = ActiveWeb.RootFolder.Files(0).NavigationNode.Label

Use the Next, Parent, Prev, or Url properties to return navigation nodes associated with the specified property. The following example returns the URL that is associated with the previous NavigationNode object.

myPrevNode = ActiveWeb.RootFolder.Files(1).NavigationNode.Prev.Url

Use the Web property to return the WebEx object associated with the current navigation node. The following example returns the WebEx object for the current navigation node.

myNavNodeWeb = _
    ActiveWeb.RootFolder.Files(2).NavigationNode.Web.Url

Use the Move method to move a navigation node from one child node to another. The following example moves a navigation node to a child location on a sibling node in the same web.

Private Sub MoveNavNode()
Dim myNodes As NavigationNodes
Dim myNode As NavigationNode

Set myNodes = ActiveWeb.RootNavigationNode.Children
Set myNode = myNodes(4)

myNode.Move myNodes, myNodes(2)
ActiveWeb.ApplyNavigationStructure
End Sub


NavigationNodes Collection Object

Multiple objects
NavigationNodes
NavigationNode

A collection of NavigationNode objects within the navigation structure of a Microsoft FrontPage-based web. Each NavigationNode object represents a pointer to a page on a web. The NavigationNode object is a member of the NavigationNodes collection.

Using the NavigationNodes Object

Use the NavigationNode property to return the NavigationNode object for a WebFile object. For more information on returning the collection of child nodes within the navigation structure of a web, see the Children property. The following example builds a list of the navigation labels that are associated with each NavigationNode object in the NavigationNodes collection. The procedure exits when it reaches the end of the navigation structure.

Private Sub GetNavigationNode()
    Dim myWeb As WebEx
    Dim myWebFiles As WebFiles
    Dim myWebFile As WebFile
    Dim myNavNodeLabel As String
    Dim myLabel As String

    On Error Resume Next

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    With myFiles
        For Each myFile In myFiles
            myLabel = myFile.NavigationNode.Label
            If Err <> 0 Then Exit Sub
            myNavNodeLabel = myNavNodeLabel & myLabel & vbCRLF
        Next
    End With
End Sub

Use Children(index), where index is the index number of an item in the collection of child nodes, to return a single NavigationNode object. The following example returns the first NavigationNode object in the collection—which is the Home page.

Set myNavNodeOne = ActiveWeb.RootNavigationNode.Children(0)

Use the Add method to add a NavigationNode object to the NavigationNodes collection. The following example adds a navigation node to the rightmost position in the current navigation structure.

Private Sub AddNewNavNode()
    Dim myWeb As WebEx
    Dim myNewNavNode As NavigationNode
    Dim myNavChildren As NavigationNodes

    Set myWeb = ActiveWeb
    Set myNavChildren = _
        myweb.rootfolder.Files(1).NavigationNode.Children
    myNewNavNode = _
        myNavChildren.Add("C:\My Webs\Sale.htm", "Sale", fpStructRightmostChild)
    myWeb.ApplyNavigationStructure
End Sub

Note After you finish modifying your navigation structure, you must apply the changes using the ApplyNavigationStructure method before the navigation structure is updated in FrontPage.


PageWindowEx Object

PageWindows
PageWindowEx
Multiple objects

Represents an open editor session and encapsulates the Microsoft FrontPage Page object model that is compatible with the document object model for Microsoft Internet Explorer 4.0 and later. The PageWindowEx object is a member of the PageWindows collection and represents all of the open page windows in the specified web. Within the PageWindows collection, individual PageWindowEx objects are indexed beginning with zero.

Note You can also substitute the Caption property of the PageWindow object instead of the index number when accessing a PageWindowEx object. This only works when the PageWindowEx object has already been saved. The following statements return the PageWindowEx object for an open page window that has a caption of "C:\My Webs\Rogue Cellars\Zinfandel.htm").

Set objPageWindow = ActiveWebWindow.PageWindow("Zinfandel.htm")
Set objPageWindow = WebWindows(0).PageWindow("Zinfandel.htm")

Using the PageWindow Object

Use PageWindows(index), where index is the index number of a page window item, to return a single PageWindowEx object. The following statement returns the file URL of the first page window item in the PageWindows collection.

PgePageOne = WebWindows(0).PageWindows(0).Document.Url

Use the ActiveFrameWindow property to return the active frame of a PageWindowEx object. The following statement returns the ActiveFrameWindow object.

Note The active frame is the frame that currently has the focus, it is shown in FrontPage with a blue border surrounding it.

Set objActiveFrame _
    = WebWindows(1).ActivePageWindow.ActiveFrameWindow

Use the FrameWindow property to return an FPHTMLWindow2 object, which can then be used to return the frames collection and the content of each of the frames collection pages.

objFrameWindow = WebWindows(0).ActivePageWindow.FrameWindow

Use the Document property to return the document associated with the PageWindowEx object. The following statement returns the document associated with the first PageWindowEx object of the first WebWindowEx object.

Set objDoc = WebWindows(0).PageWindows(0).Document

You can use the IsDirty property to determine if the PageWindowEx object is dirty—that is, if it has been modified since the last refresh or save. The isDirty property returns True if the PageWindowEx object is dirty. The following example saves the PageWindowEx object if the first item in the PageWindows collection is dirty.

Private Sub CheckPageWindowIsDirty()
    Dim objPageWin As PageWindowEx

    Set objPageWin = WebWindows(0).PageWindows(0)

    If objPageWin.IsDirty = True Then
        objPageWin.Save
    End If
End Sub

You can use the ViewMode property to set the view for the page as shown in the following statement. For more information on the enumerated constants available for this property, see the table under the ViewMode property.

WebWindows(1).PageWindows(1).ViewMode = fpPageViewHtml


PageWindows Collection Object

WebWindowEx
PageWindows

A collection of PageWindowEx objects. Each PageWindowEx object represents an open web page in a Microsoft FrontPage application window. The PageWindowEx object is a member of the PageWindows collection.

Using the PageWindows Object

Use the PageWindows property to return the PageWindows collection. The following statement returns the PageWindows object to the myPages variable.

myPages = WebWindows(0).PageWindows

Use PageWindows(index), where index is the index number of an item in the PageWindows collection, to return a single PageWindowEx object. The following statement returns the first PageWindowEx object in the collection.

Set myPageWindow = WebWindows(0).PageWindows(0)

Use the Add method to add a page window to the PageWindows collection. The following example opens the specified page in myWebOne and adds the page to the PageWindows collection.

Dim myPageWindows As PageWindows
Set myPageWindows = ActiveWeb.WebWindows(0).PageWindows
myPageWindows.Add("C:\My Webs\myWebOne\bugrep.htm")

Use the Application property to return the Application object from the PageWindows collection. The following example returns the Application object from the PageWindows collection.

myAppName = WebWindows.PageWindows.Application.Name

Use the Close method to close a PageWindowEx object or the collection of open PageWindows. The following statement closes the fourth PageWindowEx object for the first WebWindowEx object.

WebWindows(0).PageWindows(3).Close

Use Close(index), where index is the index number of an item in the PageWindows collection, to close a single PageWindowEx object as shown in the following statements. Both statements close the same page window. In the first statement, you close the page window using the index number for the Close method, while in the second statement, you close the page window by specifying the index number for the page you want to close.

WebWindows(0).PageWindows.Close(2)
WebWindows(0).PageWindows(2).Close

Use Close() to close all of the open PageWindowEx objects in the PageWindows collection. The following statement closes all of the open pages in the PageWindows collection.

WebWindows(0).PageWindows.Close()

Use the Count property to return the total number of page windows in the PageWindows collection. The following example returns the number of page windows in the collection of PageWindows.

myPageCount = WebWindows(0).PageWindows.Count

Use the Parent property when you want to return the container for the PageWindows collection. The following statement returns the WebWindowEx container object for the first PageWindowEx object using the Parent property.

Set myParent = ActiveWeb.WebWindows(0).PageWindows.Parent


Properties Collection Object

Multiple objects
Properties

A collection of meta data as Property objects. Each item in the Properties collection represents an item associated with an individual WebEx, WebFile, or WebFolder object. For more information, refer to the table of PropertyKeys in Using the PropertyKeys. Choose a topic from the following list to go directly to that topic.

Using the Properties Object

Using the Properties Collection Within a Web

Using the PropertyKeys

Using the Properties Object

Use the Add method to add a property to the Properties collection. The following statement adds a copyright statement to the Properties collection.

ActiveWeb.Properties.Add "Copyright", _
    “Copyright 1999 by Rogue Cellars”)

You can also add and remove categories and approval levels.

Use the ApplyChanges method to apply a Property object that has been added to the collection of Properties. The following statements add and apply a copyright property to the Properties collection.

ActiveWeb.Properties.Add "Copyright", _
    “Copyright 1999 by Rogue Cellars”)
ActiveWeb.Properties.ApplyChanges

Use the Count property to return the total number of properties in the Properties collection. The following example checks that the number of properties in the Properties collection has increased since the Copyright property was added and applied to the collection, and then goes on to add the copyright to a web page.

Note   To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). In either case, you may substitute an alternative web URL or file.

Private Sub copyrightAdd()
    Dim myWeb As WebEx
    Dim myCopyright As String
    Dim myCount As Integer
    Dim myMessage As String

    myCopyright = "Copyright 1999 by Rogue Cellars"
    myCount = ActiveWeb.Properties.Count
    myMessage = "No new properties have been added."

    Set myWeb = Webs.Open("C:\My Webs\Rogue Cellars")
    myWeb.Activate
    ActiveWeb.Properties.Add "Copyright", myCopyright

    If myCount <> ActiveWeb.Properties.Count – 1 Then
        MsgBox myMessage
        Exit Sub
    End If

    ActiveWeb.RootFolder.Files("Zinfandel.htm").Open
    ActiveDocument.body.insertAdjacentText "BeforeEnd", _
        ActiveWeb.Properties("Copyright")
    ActivePageWindow.Save
    ActiveWeb.Close
End Sub

Use the Delete method to delete a single property. The following statement deletes the Copyright property from the Properties collection.

ActiveWeb.Properties.Delete("Copyright")

Use the Parent property when you want to return the container for the Properties collection. For example, the following statement returns the URL of the parent web.

myParentURL  = ActiveWeb.Properties.Parent.Url

Using the Properties Collection Within a Web

Use Properties(index), where index is the PropertyKey of the item in the Properties collection, to return a single property. The following example returns the value of the PropertyKey vti_hassearchbot.

Private Sub CheckForSearchBot()
    Dim myProperties As Properties
    Dim myFoundSearchBot As Boolean

    Set myProperties = ActiveWeb.Properties

    With myProperties
        myFoundSearchBot = .Item("vti_hassearchbot")
    End With
End Sub

Important   The values for properties are variant—that is, each value can be a string, a Boolean, or an array. You can use the Typename() function to determine the type of the property value.

Note   To run the following example you must create a form that contains a text box called txtCategories. Also, notice that myCategories is declared as a variant type in this example. In a previous example, myFoundSearchBot was declared Boolean—but could also have been declared as a string.

Private Sub GetWebPropertyCategories()
    Dim myProperties As Properties
    Dim myCategories As Variant
    Dim myCategory As Variant
    Dim txtCategories As String

    Set myProperties = ActiveWeb.Properties

    With myProperties
        myCategories = .Item("vti_categories")
        For Each myCategory In myCategories
            txtCategories = txtCategories & "|" & myCategory
        Next
    End With
End Sub

Using the PropertyKeys

The property keys can be a valuable tool for organizing information about your webs. For example, you can add categories to the master list of categories on your web.

Important   The category names can be added to the categories list using case sensitivity, but will not display with case sensitivity in the User Interface (UI). Because of this, a situation may occur where a user creates a category on the client, such as "Web Administrators", and a duplicate category exists on the server, such as "web administrators". In this case, in the UI, FrontPage will assign both categories to the "web administrators" category and neither of these can be deleted from the web (in the UI). Programmatically, the case sensitivity will correctly display in the Immediate and Local windows of the Visual Basic Editor.

The following example first adds a category to the properties for the active web, deletes the Waiting category from the same list (vti_categories), and then adds the new category to each of the files in the active web.

Note   When creating a new category, you must first add the new category to the web before you add it to any of the files. The procedure, AddCategories, adds a new category to the web and the next procedure, AddCategoryToFiles, adds the same category to all of the files in the web.

Private Sub AddCategories()
    Dim myWeb As WebEx
    Dim myCategory(2) As String
    Dim myItem As Variant

    Set myWeb = ActiveWeb
    myCategory(0) = "+web administrators"
    myCategory(1) = "-waiting"
    ActiveWeb.Properties("vti_categories") = myCategory
    ActiveWeb.Properties.ApplyChanges

    'List all of the items in vti_categories in the Immediate window
    For Each myItem In myWeb.Properties("vti_categories")
        Debug.Print myItem
    Next
End Sub

Private Sub AddCategoryToFiles()
    Dim myWeb As WebEx
    Dim myCategories(1) As String
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myItem As Variant

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files
    myCategories(0) = "+web administrators"

    For Each myFile In myFiles
        myFile.Properties("vti_categories") = myCategories
        myFile.Properties.ApplyChanges
        'List all the items in vti_categories in the Immediate window
        For Each myItem In myFile.Properties("vti_categories")
            Debug.Print myItem
        Next
    Next
End Sub

Note   Although you can create new categories, such as "web administrators", that aren't included in the categories that are automatically installed with FrontPage, these new categories won't be visible in the User Interface (UI) until they are added to the web. Notice that in the previous example, the new category was added to the web first and will be visible in the UI.

The following table provides detailed information about the property keys available in FrontPage. Notice that all property keys in FrontPage start with “vti_”. It is suggested that you prefix the property keys you want to add with a short name, such as an abbreviation for the name of your company, to reduce chances of naming conflicts with other properties.

Property Key | Description | Permission
vti_approvallevel | The approval level set for a page. The available levels are AssignedTo, ReviewStatus, and Categories. | Read/write
vti_approvallevels | List of available approval levels that can be applied to documents in a web. This property key is a string vector (or an array of strings). Used to populate the web-wide list of known "review statuses" (also known as "approval levels") that are set for a document. The approval levels you can set are AssignedTo, ReviewStatus, and Categories. | Read-only
vti_approvedby | The authenticated name of the person who approved the page. | Read-only
vti_assignedby | The authenticated name of the person who assigned the page to a user. | Read-only
vti_assigneddate | This is the date that the page was last assigned to a user. | Read-only
vti_assignedto | The authenticated name of the person to whom the page is assigned. | Read-only
vti_author | Returns the author's name in string format. The identification of the authenticated author who has, or is, making changes to the document. Note This is different from the Author property stored as part of Microsoft Office document properties, which can be set by the user to any arbitrary value. | Read-only
vti_casesensitiveurls | True if the web is running on a server where URLs are case sensitive, such as a server running UNIX. For example, if this property is set to True, then a file named MyFile.htm and a file named myFile.htm are treated as two separate files. | Read-only
vti_categories | The master list of categories. This property key is a string vector (or an array of strings) that is used for both web-level and document-level meta data. At the web level, the property key contains a list of all known categories that exist in the web. At the document level, it contains a list of all the categories to which the specified document belongs. Note These categories are automatically updated whenever a category is added or modified in any way. | Read/write
vti_clientvercutoff | You can use this property key to set a version cutoff string. This is most commonly used in a multi-version environment to prevent older versions of the application from running on a specific server. For more information, see the FrontPage Server Extensions Resource Kit. | Read/write
vti_dataconns | List of data connections used by database features in FrontPage. | Read-only
vti_defaultcharset | The default character set for the web or page. | Read-only
vti_defaultlanguage | The default language for the web or page. | Read-only
vti_description | Provides a multi-line text box for the user to write comments in. | Read/write
vti_donotpublish | Set to True if the page is marked as "draft" or "not to be published." | Read/write
vti_filesize | The size of the file in bytes. | Read-only
vti_generator | This property key corresponds to the generator tag within an HTML document. The value of the vti_generator property key contains the name of the application that "generated" the document, which may be different from the application that was invoked to handle the page. For example, if you created or edited a page with Microsoft Word, and then retrieved the value of the vti_generator property key in Microsoft Visual Basic for FrontPage for that document, the value of the vti_generator property key would be Microsoft Word--even though the procedure call was generated by FrontPage. Valid values are "Microsoft Word", "Microsoft Access", "Microsoft FrontPage", and so on. Note FrontPage defers to Word when there's a theme conflict if the vti_generator property key contains "Microsoft Word". | Read-only
vti_globalpage | Marks a page as global, that is, a top level page in the navigation structure, on the same level as, but not equal to, the home page. | Read/write
vti_hasframeset | True if the page contains framesets. This property key is used when constructing navigation bar links. When the page that is being linked is a frameset, the link's target attribute is forced to "_top". This causes the new page to replace the current frameset to prevent recursive framesets at browse time. | Read-only
vti_hasruntimebots | True if the page has run-time bots on it. | Read-only
vti_htmlextensions | A concatenated string of extensions used to specify a web file, such as htm.html.asp. | Read-only
vti_httpdversion | The version of FrontPage that is running on the httpd server. | Read-only
vti_imagemapformat | This property key sets the URL format used by the server-side image map processor. Valid values are NCSA and CERN. This property key is only useful for prior versions of FrontPage. FrontPage now uses client-side image maps. | Read/write
vti_imagemapurlprefix | Sets the server-relative URL of the server-side image-map processor for the selected image-map format. If the value of the vti_imagemapurlprefix property key is set to an empty string (""), server-side image maps are handled automatically by the FrontPage Server Extensions. For other formats, provide the name and location of the image-map processor. To specify client-side image maps, set this variable to an empty string. For more detailed information, refer to the FrontPage Server Extensions Resource Kit. | Read/write
vti_insecureserverurl | Retrieves the http:// URL (unsecured URL) for a Web site. Provides compatibility with older browsers that may not have secure browsing capability. For more information, see the FrontPage Server Extensions Resource Kit. | Read-only
vti_isbrowsable | True if the page folder is browsable. Use Folder.IsBrowsable to set this value.. | Read-only
vti_ischildweb | True if the specified folder is the root of a subweb. Use Folder.MakeWeb and Folder.RemoveWeb to modify. | Read-only
vti_isexecutable | Set this property to True to enable if this folder is marked for executable content on the server. Use Folder.IsExecutable to set this value. | Read/write
vti_isscriptable | Set this property to True to if enable scripting is enabled for a this folder. Use Folder.IsScriptable to set this value | Read-write
vti_longfilenames | True if the server supports file names that are longer than the standard 8.3 file format. (The 8.3 file format only supports file names with eight characters and extensions with three characters, such as "filename.txt".) | Read-only
vti_metatags | This property key corresponds to the contents within the META tags in an HTML document. All of the information contained in this property key is added to the META tags collection. | Read-only
vti_modifiedby | Authenticated name of the author who last modified the page. | Read-only
vti_navbuttonhomelabel | The image file associated with the button that links to the home page. Note This image is retrieved from the theme associated with the file and is not customizable. | Read/write
vti_navbuttonhomelabeltext | The text that overlays the vti_navbuttonhomelabel. Note This text is customizable by the user. | Read/write
vti_navbuttonlabeltext | The text that overlays the vti_nvabuttonuplabel. Note This text is customizable by the user. | Read/write
vti_navbuttonnextlabel | The image file associated with the button that links to the next page in the navigation structure. Note This image is retrieved from the theme associated with the file and is not customizable. | Read/write
vti_navbuttonnextlabeltext | The text that overlays the vti_navbuttonnextlabel. Note This text is customizable by the user. | Read/write
vti_navbuttonprevlabel | The image file associated with the button that links tot he previous page in the navigation structure. Note This image is retrieved from the theme associated with the file and is not customizable. | Read/write
vti_navbuttonprevlabeltext | The text that overlays the vti_navbuttonprevlabel. Note This text is customizable by the user. | Read/write
vti_navbuttonuplabel | The image file associated with the button that links to the page one level up in the navigation structure. Note This image is retrieved from the theme associated with the file and is not customizable. | Read/write
vti_noclientimagemaps | True if client image maps are prohibited. | Read-only
vti_nonnavpage | True if the page isn't associated with a navigation node within the navigation structure. | Read/write
vti_nosourcecontrol | True if the web is not being stored under source control. Prevents adding a file to source control if this property is set to True. Note If a file has previously been added to a source control project with the vti_nosourcecontrol property set to False, and the property is subsequently set to True, the file will not be removed from the source control project. | Read/write
vti_originator | This property key corresponds to the "originator" META tag in an HTML document. The value of this property key contains the name of the application that created the document. You should never overwrite this property key with the name of another application. The vti_generator property key should be used to track the application that last "generated" the HTML page. Simply editing a document in FrontPage will change the value of the vti_generator property key to "Microsoft FrontPage". Valid values are "Microsoft Word", "Microsoft Access", "Microsoft FrontPage", and so on. Note FrontPage defers to Word when there's a theme conflict if the vti_generator property key contains "Microsoft Word". | Read-only
vti_privatetext | The value of this property key must be an integer. Zero or not present is the default. A non-zero value means that the page won't be added to any text indexes. This property key only works with the built-in text indexing in FrontPage and is not recognized by Microsoft Internet Information Services (IIS). | Read/write
vti_progid | This corresponds to the "progid" META tag in an HTML document. The value of this property key determines which application opens the document when a user clicks (or double-clicks) the document's file name in Windows Explorer. Valid values are "FrontPage.Editor.Document", "Word.Document", "Excel.Sheet", "PowerPoint.Slide", "Access.Application". Note FrontPage defers to Word when there's a theme conflict if the vti_generator property key contains "Microsoft Word". | Read-only
vti_scriptlanguage | Indicates which scripting language is enabled on the server. | Read-only
vti_secureserverurl | Retrieves the https://URL (secured URL) for a Web site. Provides a secure environment for confidential transactions over the Internet. For more information see the FrontPage Server Extensions Resource Kit. | Read-only
vti_serveripaddress | The IP address of the server. Note An IP address beginning with 127 represents a local server. | Read-only
vti_serverlanguage | The language of the operating system. Used for localization purposes. | Read-only
vti_showhiddenpages | True if hidden pages are displayed. | Read-only
vti_sourcecontrolcheckedoutby | Authenticated name of the author who last checked out a page. | Read-only
vti_sourcecontrolerror | The error last returned by the source control system. This error is added to the META tag information if an error occurs while the file is being added to a source control project. | Read-only
vti_sourcecontrolproject | The name of the source control project. For a Microsoft Visual SourceSafe project, the string would include the "$" symbol, as in "$/myProject" | Read-only
vti_sourcecontrolsystem | The value of this property key is the type of source control in use on that web. Can be Microsoft Visual SourceSafe or Microsoft Frontpage Light Weight source control. Valid values for these two types of source control are "VSS" and "LW", respectively. This property key is set when a source control project is started. For more information on source control projects, refer to Managing Source Control Projects. | Read-only
vti_sourcecontrolversion | A numbered string that contains the version of the source control system that is in use. | Read-only
vti_textextensions | A concatenated string of extensions that are commonly used to denote text files. For example, the concatenated string might contain ".txt.rpt..." | Read-only
vti_themedefault | The default theme of the web. | Read-only
vti_themesusecss | True if CSS is used to present the theme. | Read/write
vti_timecreated | The timestamp when the page was created. The timestamp is in Universal Time Coordinate (UTC) or Greenwich time. | Read-only
vti_timelastmodified | The time that the page was last modified. The timestamp is in UTC time. This is only set when the author edits the page directly. | Read-only
vti_timelastwritten | The time that the page was last rewritten. The timestamp is in UTC time. | Read-only
vti_-title | The value of the text between the <TITLE> tags on the page. | Read-only
vti_usernames | The list of known user names for a specified web. | Read-only
vti_webservertype | The type of Web server. Valid values include, "MSIIS" for Microsoft Internet Information Services and "PWS" for Personal Web Server. | Read-only
vti_welcomenames | A concatenated list of file names that can be used as the file name for the home page, such as "index.htm index.html default.htm". | Read-only


Survey Object

Survey
Multiple objects

Contains information about the Microsoft FrontPage Survey object that allows users to vote on issues and share information.

Using the Survey object

Use Lists.Item(index), where index is is the name or ordinal position of a List object of type fpListTypeSurvey, to return a single Survey object.

The following example lists the names of all surveys in the active web. If the web contains no surveys or the web contains no lists, a message is displayed to the user.

Sub ListAllSurveys()
'Displays the names of all survey objects in the collection

    Dim lstWebList As List
    Dim strName As String
    Dim blnFound As Boolean

    'Set found flag to false
    blnFound = False
    'Check if any lists exist
    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists
        For Each lstWebList In ActiveWeb.Lists
            If lstWebList.Type = fpListTypeSurvey Then
                'Set boolen flag to found
                blnFound = True
                'add list names to string
                If strName = "" Then
                    strName = lstWebList.Name & vbCr
                Else
                    strName = strName & lstWebList.Name & vbCr
                End If
            End If
        Next
        If blnFound = True Then
            'Display names of all survey objects
            MsgBox "The names of all survey objects in the current web are:" _
                   & vbCr & strName
        Else
            MsgBox "There are no survey objects in the current web."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub

Use the Lists collection's Add method to create a new list of type fpListTypeSurvey. The following example creates a new survey called NewSurvey.

Sub NewSurvey()
'Adds a new Survey to the current web

    Dim objApp As FrontPage.Application
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists
    'Add new survey
    objLists.Add Name:="NewSurvey", _
                 ListType:=fpListTypeSurvey, _
                 Description:="New Survey"

    'Display message to user
    MsgBox "A new survey was added to the Lists collection."

End Sub


System Object

Application
System

Represents the Microsoft FrontPage accessor for the System object and provides access to information such as the operating system, screen resolution, or registry information.

Using the System Object

Use the System property to return the System object. The following statement returns the name of the calling application.

mySysApp = System.Application.Name

Use the Build and Version properties to return build and version information about the operating system.

myVer = System.Version
myBld = System.Build

The horizontal and vertical resolution can be used to determine if a graphic can be displayed on a client’s machine. The following statements return the resolution settings.

currHorizRes = System.HorizontalResolution
currVertRes = System.Vertical.Resolution

Use the OperatingSystem property to return the name of the current operating system, as shown in the following statement.

thisOps = System.OperatingSystem

Use the Parent property to return the parent of the specified object. The following statement returns parent information for the System object.

Private Sub GetSystemParentInfo()
    Dim mySys As System
    Dim mySysUserName As String

    Set mySys = System

    With mySys
        mySysUserName = .Parent.UserName
    End With
End Sub

Use the LanguageDesignation property to return a three-letter abbreviation for the language used for the operating system. The following statement returns "enu" as the language designation abbreviation for the English (US) language.

currSystemLanguage = System.LanguageDesignation

Use the ProfileString property to return or set an entry in the Windows registry. If used without parameters, the ProfileString property defaults to the following key:

HKEY_CURRENT_USERS\Software\Microsoft\FrontPage

The parameters for the ProfileString property are:

  • RegistrySection, where RegistrySection is a registry subtree such as HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE.
  • RegistryKey, where RegistryKey is the next level below the section or subtree with such key names as Software or Network.

The following example returns the Identifier for the CentralProcessor subkey.

Private Sub GetProfileString()
    Dim mySys As System
    Dim myRegSec As String
    Dim myRegKeyInfo As String

    Set mySys = System

    myRegSec = _
     "HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0"

    myRegKeyInfo
        = mySys.ProfileString(myRegSec, "Identifier")
End Sub


Theme Object

Themes
Theme

Represents a theme in Microsoft FrontPage. The Theme object is a member of the Themes collection. The Themes collection represents all the themes on the local machine or all themese applied to a specific web. Within the Themes collection, individual Theme objects are indexed beginning with zero.

Using the Theme Object

Use the Format property to return format information for a theme. The following statement returns the format for the theme applied to the active FrontPage-based web page.

myThemeFormat = Theme.Format

Use the Label property to return the name that is displayed in the Theme list box — this is the full name of the theme. The following statement returns the label for the theme.

myThemeLbl = Theme.Label

Use the Name property to return or apply a theme to a web page. The Name property contains the directory name for the theme—an abbreviated version of the name of the theme as displayed in the Theme list box. The following example lists the names of all themes in the themes collection in the body of the active document.

Note To run this example, you must have a web open that has a theme applied to the active page, the entire web, or a file in the web.

Sub ListThemes()

    Dim objTheme As Theme

    For Each objTheme In Application.Themes
        ActiveDocument.body.insertAdjacentText "beforeend", objTheme.Name
    Next

End Sub

Use the Version property to return the version number of the theme. The following example returns the version for a theme.

myThemeVersion = Theme.Version


Themes Collection Object

Multiple objects
Themes
Theme

A collection of Theme objects. Each Theme object represents a theme associated with an HTML page or a web in Microsoft FrontPage. The Theme object is a member of the Themes collection.

Using the Themes Collection

Use the Themes property to return the Themes collection. The Themes property can be used with either Application or WebEx objects. The Themes property for the Application object is the collection of themes available in FrontPage. The Themes property for the WebEx object is the collection of themes applied to the files within a web, or the collection of themes applied to a web. The following statement illustrates both the Themes and Count properties and returns the number of items in the Themes collection that are available in FrontPage.

myTotalThemeCount = Application.Themes.Count

The following statement returns the number of themes within a web.

myWebThemeCount = Application.Webs(0).Themes.Count

Use Themes(index), where index is the index number of a theme item, to return a single Theme object. The following statement returns the first theme in the Themes collection.

myThemeOne = Web.Themes(0)

Use the Application property to return the Application object. The following example returns the version and build number of FrontPage from within the Themes collection.

Note To run this procedure you must have at least one open web.

Private Sub GetBuildNumber()
    Dim myThemes As Themes
    Dim myBuild As String

    Set myThemes = ActiveWeb.Themes

    myBuild = myThemes.Application.Build
End Sub

Use the Parent property when you want to return the container for the Themes collection. For example, the following statement returns the URL associated with the parent container of the Themes collection.

myParentUrl = Web.Themes.Parent.Url


WebEx Object

Webs
WebEx
Multiple objects

Represents a Microsoft FrontPage web. The WebEx object is a member of the Webs collection, which represents all of the open webs in a Web site. FrontPage provides the ability to create multiple WebEx objects on a Web server. Within the Webs collection, individual WebEx objects are indexed beginning with zero. The directory hierarchy of a web site in FrontPage is similar to a folder hierarchy. Any WebFolder can represent a web site, but every WebFolder does not necessarily represent a web site. The Web folder hierarchy provides the link to folders and files on a Web server directory.

Using the Web Object Properties

Use the Web property to return the WebEx object. The following example checks the web’s operating system for the capability of processing long file names.

Note To run this example, create a form with a command button called cmdCheckLongFilenames, a text box called txtLongFilenames, and copy the example into the code window.

Private Sub cmdCheckLongFilenames()

    Dim objPageWin As PageWindow
    Set objPageWin = ActivePageWindow

    With objPageWin
        If .Web.AllowsLongFilenames = True Then
            txtlongFilenames = _
            "This operating system uses long file names."
            Exit Sub
        Else
            txtlongFilenames = _
            "This operating system only uses short file names."
        End If
    End With

End Sub

Use Webs(index), where index is the index number of a web item, to return a single WebEx object. The following example returns the URL of the first web item in the Webs collection.

Application.Webs(0).Url

Use the ActiveWebWindow property to return the selected WebWindowEx object. From the WebWindowEx object, you can access the ActiveDocument, ActivePageWindow, or Application properties, along with properties such as Caption, PageWindows, Parent, ViewMode, Visible, and Web. The following example returns the creation date and file size of the active document.

Note Although Date is an available type in Visual Basic for Applications, the WebWindowEx object returns the date in string format and does not automatically convert the string to a date format.

Private Sub ActiveDocDateSize()
    Dim objWebWindow As WebWindowEx
    Dim strFileSize As String
    Dim strCreateDate As String

    Set objWebWindow = ActiveWebWindow

    With objWebWindow
        strFileSize = .ActiveDocument.fileSize
        strCreateDate = .ActiveDocument.fileCreatedDate
    End With
End Sub

The RevisionControlProject and IsUnderRevisionControl properties return the status of the WebEx object’s revision state. You can control versioning in Microsoft FrontPage through Microsoft Visual SourceSafe or through Microsoft Office-style locking. For more information on source control projects and Office-style locking, refer to Managing Source Control.

If a revision control project does not correspond to a valid Visual SourceSafe project, FrontPage defaults to Office-style locking. The following example returns the RevisionControlProject and IsUnderRevisionControl properties, and includes a source control project example.

Note To run this example, create a module and copy the example into the code window. You must have a web open.

Private Sub SourceControl()

    Dim objWeb As WebEx

    Set objWeb = ActiveWeb
    If Not(objWeb.IsUnderRevisionControl) Then
        objWeb.RevisionControlProject = "<FrontPage-based Locking>"
    End If
End Sub

Private Sub ReturnRevisionState()
    Dim objWeb As WebEx
    Dim strRevCtrlProj As String
    Dim blnIsUnderRevCtrl As Boolean

    Set objWeb = ActiveWeb

    With objWeb
        RevCtrlProj = .RevisionControlProject
        blnIsUnderRevCtrl = .IsUnderRevisionControl
    End With
End Sub

Use the RootFolder and RootNavigationNode properties to determine the root folder or root navigation node. The RootFolder property returns a pointer to the root folder of a Web site. The RootNavigationNode property returns the NavigationNode object from which you can access all other navigation nodes in a web. The RootNavigationNode object is created by default when you create a Web, and provides the basis for the navigation structure, which is accessed through the Children property. The first child node of the navigation structure is the home page of the web. The following example returns the name of the root folder and the URL of the RootNavigationNode object.

Private Sub GetRootInfo()
    Dim objWeb As WebEx
    Dim strRootFolder As String
    Dim strHomeNavNode As String

    Set objWeb = ActiveWeb

    With objWeb
        strRootFolder = .RootFolder.Name
        strHomeNavNode = .RootNavigationNode.Children(0).Url
    End With
End Sub

Use the SharedBorders property to set the shared borders for a web either on or off. The following statement sets the SharedBorders property to True and turns shared borders on for the specified web.

ActiveWeb.SharedBorders(fpBorderTop) = True

Use the WebWindows property to return the collection of WebWindow objects that are contained within the current WebEx object. The following statement returns a count of the WebWindows collection.

Application.WebWindows.Count

Using the Web Object Methods

Use the Activate method to place the focus on the current object. The following statements check if myAdventureWorksWeb is the active web; if it is not, then myAdventureWorksWeb is activated.

If ActiveWeb <> myAdventureWorksWeb Then
    objAdventureWorksWeb.Activate
End If

Use the ApplyNavigationStructure method to apply a newly created or modified navigation structure to a Web site. The following statement applies a navigation structure to a web, where the variable for the Adventure Works web is webAdventureWorksWeb.

myAdventureWorksWeb.ApplyNavigationStructure

Use the CancelRequests method to cancel all server requests. The following statement cancels all server requests for the Adventure Works web, with webAdventureWorksWeb as the web variable.

Note The client will stop all requests to the server; however, the server may have already started a transaction, in which case it will continue until the transaction is finished and then the remaining requests (if any) will be cancelled.

myAdventureWorksWeb.CancelRequests

Use the LocateFile or LocateFolder methods to return a WebFile or a WebFolder object within a web. The following example locates a folder for a disk-based web.

Application.Web.LocateFolder("C:\My Webs\Adventure Works\images")

Use the Publish method to publish a web to a Web server. The following statement publishes the Adventure Works web to a Personal Web Server site.

Dim objWeb As WebEx

Set objWeb = Application.Web

With objWeb
    .Publish _
    "http://myServer/wwwroot", fpPublishAddToExistingWeb

The FpWebPublishFlags enumerated types can be concatenated as shown in the following statement.

myWeb.Publish _
    "http://myServer/wwwroot", fpPublishAddToExistingWeb + _
    fpPublishCopySubwebs


WebFile Object

Multiple objects
WebFile
Multiple objects

Represents a file in a Microsoft FrontPage-based web. The WebFile object is a member of the WebFiles collection. The WebFiles collection represents all of the files in a specified WebFolder object. Within the WebFiles collection, individual WebFile objects are indexed beginning with zero. The WebFile object is similar to a file in a directory-based hierarchy. FrontPage provides the ability to create multiple Web objects on a Web server. Any WebFolder can represent a Web site, but every WebFolder does not necessarily represent a Web site.

Using the File Object

Use WebFiles(index), where index is the index number of a web file item, to return a single WebFile object. The following example returns the file name of the first web file item in the WebFiles collection.

ActiveWeb.RootFolder.Files(0).Name

Use the File object to return information about a file on a web. The following example returns the Name, Title, and Url properties of each File object on the active web.

Note To run this program, you must have a least one web open.

Private Sub GetWebFileInfo()
    Dim myWeb As WebEx
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myFileName As String
    Dim myTitle As String
    Dim myUrl As String

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    With myWeb
        For Each myFile In myFiles
            myFileName = myFile.Name
            myTitle = myFile.Title
            myUrl = myFile.Url
        Next
    End With
End Sub

Use the IsOpen property to check if a file is currently open in Page view. The following example returns the IsOpen property for a specified File object. Notice that the Edit method is used to open the file in this example. For more information on using these methods, see the Edit method.

Note You must have a web open to run this program.

Private Sub CheckForOpenFile()
    Dim myWeb As WebEx
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myFileToOpen As String
    Dim myMessage As String
    Dim myFileName As String

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    myFileToOpen = "index.htm"
    myMessage = "This file is currently open."

    With myWeb
        For Each myFile In myFiles
            myFileName = myFile.Name
            If myFileName = myFileToOpen Then
                If myFile.IsOpen = True Then
                    MsgBox (myMessage)
                    Exit Sub
                Else
                    myFile.Edit fpPageViewNormal
                    Exit Sub
                End If
           End If
        Next
    End With
End Sub

Use the Checkin, Checkout, and UndoCheckout methods to manage file resources through source control on a web. The following statement checks out the first file in the active web.

Note You must have a source control project set up in order for this to work.

myFileCheckedOut = ActiveWeb.RootFolder.Files(1).Checkout

Similar to file management features in Microsoft Visual SourceSafe, FrontPage also provides an UndoCheckout method that you can use to return a file to its original state. The following statement returns the file to its original state.

myFileCheckedOut = ActiveWeb.RootFolder.Files(1).UndoCheckout

You can use the CheckedoutBy property before attempting to check out a file to see if the file is currently checked out and by whom. The following statement returns the logon alias of the person who checked out a file or is null if the file isn't currently checked out.

myWhoCheckedOutFile = ActiveWeb.RootFolder.Files(0).CheckedoutBy

Use the Properties property to return information about a web, such as the type of Web server (vti_webservertype) or if the web has a search bot (vti_hassearchbot). The Properties property returns a collection of key-value pairs used to maintain the meta information. The following statement returns True for the variable mySearchBot if the web has a search bot.

mySearchBot = ActiveWeb.Properties.Item("vti_hassearchbot")

Use the MetaTags property to return information about the meta tags contained in the HTML coding of a file. The MetaTags property returns a collection of meta tags for a File object, such as the generator of the file. The following example returns the file name and meta tags for each file in a web.

Note To run this program, you must have a least one web open.

Private Sub GetMetaTags()
    Dim myWeb As WebEx
    Dim myMetaTag As Variant
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myMetaTags As MetaTags
    Dim myFileName As String
    Dim myMetaTagName 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
            Next
        Next
    End With
End Sub

Use the SharedBorders property to return the shared borders on the current web page or to set new shared borders. The following statement returns the top shared border of the first file in the Files collection of the active web.

myTopBorder _
    = ActiveWeb.RootFolder.Files(0).SharedBorders(fpBorderTop)

You can also set shared borders on a web file, as shown in the following statement.

ActiveWeb.RootFolder.Files(0).SharedBorders(fpBorderTop) = True

Use the ThemeProperties property to return information about whether the theme uses vivid colors or active graphics? The following example returns the properties of an applied theme and adds vivid colors to the current theme properties if vivid colors haven't been applied to the specified object.

Private Sub CheckThemeProperties()
    Dim myFile As WebFile

    Set myFile = ActiveWeb.RootFolder.Files(0)

    If myFile.ThemeProperties(fpThemeActiveGraphics) Then
        myFile.ApplyTheme myFile.ThemeProperties(fpThemeName), myFile.ThemeProperties(fpThemePropertiesAll) + fpThemeVividColors
    Else
        myFile.ApplyTheme myFile.ThemeProperties(fpThemeName), myFile.ThemeProperties(fpThemePropertiesAll) + fpThemeActiveGraphics + fpThemeVividColors
    End If
End Sub

Using File Methods

Use the Copy, Delete, Edit, Move, or Open methods to manage your web files. There's a subtle distinction between the Edit and Open methods. With the Edit method, you can open and modify a FrontPage-compatible file into a PageWindow object. With the Open method, you can open both FrontPage-compatible files and any other type of file such as image or text files, into the file's associated editor. When you use the Open method to open a file type that is not FrontPage-compatible, FrontPage does not return a file object. The following example opens a file, deletes a file, and moves a file.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT).

Private Sub OpenFile()
    Dim myWeb As WebEx
    Dim myFile As WebFile

    Set myWeb = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    myWeb.Activate
    Set myFile = myWeb.RootFolder.Files("index.htm")
    myFile.Open
End Sub

Private Sub DeleteFile()
    Dim myWeb As WebEx
    Dim myFile As WebFile

    Set myWeb = ActiveWeb
    Set myFile = myWeb.RootFolder.Files(0)

    myFile.Delete
End Sub

Sub MoveFile()
    Dim myWeb As WebEx
    Dim myFile As WebFile

    Set myWeb = ActiveWeb
    Set myFile = myWeb.RootFolder.Files(0)

    myFile.Move “New Filename”, True, True
End Sub


WebFiles Collection Object

Multiple objects
WebFiles
WebFile

A collection of WebFile objects. Each WebFile object represents all of the open files in a web. The WebFile object is a member of the WebFiles collection.

Using the WebFiles Object

Use the Files property to return the WebFiles collection. The following statement returns the WebFile objects in the WebFiles collection.

Set myWebFiles = Application.Webs(0).RootFolder.Files

Use WebFiles(index), where index is the index number of an item in the WebFiles collection, to return a single WebFile object. The following statement returns the first WebFile object in the collection.

Set myWebFile = ActiveWeb.RootFolder.Files(0)

Use the Add method to add a WebFile object to the WebFiles collection. The following statement adds a new WebFile object to the collection of WebFiles.

myWebFiles.Add ("C:\New Web WebFiles\Sales Statistics.htm")

Use the Application property to return the Application object from within the WebFiles collection. The following statement returns the Application object from the WebFiles collection.

myApp = ActiveWeb.RootFolder.Files.Application

Use the Count property to return the number of open files in the WebFiles collection. The following statement returns the number of files in the collection of WebFiles.

myCount = Webs(0).RootFolder.WebFiles.Count

Use the Delete method to delete a WebFile object. The following statement deletes the third file in the WebFiles collection.

Webs(0).RootFolder.Files(2).Delete

Use the Parent property when you want to return the container for the WebFiles collection. The following statement returns the URL of the folder for second file in the active web.

myWebFileParent = ActiveWeb.RootFolder.Files(1).Parent.Url


WebFolder Object

Multiple objects
WebFolder
Multiple objects

Represents a folder in a Microsoft FrontPage-based web. The WebFolder object is a member of the WebFolders collection.

Note The Folder object is a pointer to the WebFolder object.

The WebFolders collection represents all of the folders in a specified web. Within the WebFolders collection, individual WebFolder objects are indexed beginning with zero. The WebFolder object is similar to a folder in a directory-based hierarchy; however, the relationship between WebFolder objects and Web objects is unique. FrontPage provides the ability to create multiple WebEx objects on a Web server. Any WebFolder can represent a Web site, but every WebFolder does not necessarily represent a Web site. The web folder hierarchy provides the link to folders and files on a Web server directory. The navigation structure provides the underlying structure for the Web objects within individual FrontPage-based webs.

Using the WebFolder Object

Use WebFolders(index), where index is the property key of a web folder item, to return a single WebFolder object. The following example returns the file name of the first web folder item in the WebFolders collection.

ActiveDocument.WebFolders(0).Name

Use the collection properties such as Files, Folders, or Properties, to return the collection object for the specified item. The following statements return the first specified item in the collection for the active web.

myFileOne = ActiveWeb.RootFolder.Files(0)
myFolderOne = ActiveWeb.RootFolder.Folders(0)
myPropertyOne = ActiveWeb.Properties("vti_author")

Use such properties as IsExecutable, IsReadable, IsRoot, and so on, to check for the specified state of the folder. If you have CGI scripts that you'd like to execute, you can add the scripts to a folder and set the IsExecutable property of that folder to True. When you have content in a folder that you'd like others to browse, you can set the IsReadable property to True. If you want to check whether the current folder is the root folder, you can use the IsRoot property.The following example checks if files in the current WebFolder object are executable, read-only, or located in a root folder.

Private Sub GetFolderInfo()
    Dim myWeb As WebEx
    Dim myFolder As WebFolder
    Dim myIsExe As Boolean
    Dim myIsReadable As Boolean
    Dim myIsRoot As Boolean

    Set myWeb = ActiveWeb
    Set myFolder = myWeb.RootFolder.Folders(1)

    With myFolder
        myIsExe = .IsExecutable
        myIsReadable = .IsReadable
        myIsRoot = .IsRoot
    End With
End Sub

The IsExecutable, IsReadable, and IsWriteable properties return information about the state of the folder. The following examples show how to set the IsExecutable and IsReadable properties and read the IsWriteable property.

Note You cannot set the IsWriteable property, however you can set the IsExecutable and IsReadable properties for a WebFolder object.

Sub FolderProperties ()
Dim myFolder As WebFolder

Set myFolder = ActiveWeb.RootFolder.Folders(0)

If myFolder.IsWritable Then
    MsgBox "Folder, " & myFolder.Url & " is writable"
End If

If Not(myFolder.IsReadable) Then
    MyFolder.IsReadable = True
End If

If myFolder.IsExecutable Then
    MyFolder.IsExecutable = False
End If
End Sub

Folders (or WebFolders) in FrontPage serve two purposes. They can be folders that help manage the content of the web or they can be webs. A web can have multiple subwebs below it. The IsWeb property returns True if the folder in question is a web. The following example uses the IsWeb property to determine if a folder is a web and, if so, opens the web.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). In either case, you may substitute an alternative web URL.

Private Sub CheckFolder()
    Dim myFolder As WebFolder

    Set myFolder = ActiveWeb.RootFolder.Folders("Rogue Cellars")
    If myFolder.IsWeb = True Then
        Webs.Open myFolder.Url
    End If
End Sub

Use the Url property to return the URL of the current WebFolder object. The following statement returns the absolute URL for the eighth folder in the active web.

myUrl = ActiveWeb.RootFolder.Folders(7).Url

Use the Copy, Delete, and Move methods to maintain your web structure. The following statement copies a WebFolder object from one folder to another folder, updates the links during the copy process, and forces an overwrite if the file already exists.

myFolder.Copy("C:\My Webs\New Adventure Products", True, True)


WebFolders Collection Object

Multiple objects
WebFolders
WebFolder

A collection of WebFolder objects. Each WebFolder object within the WebFolders collection represents an open folder in a web. The WebFolder object is a member of the WebFolders collection.

Note All of the methods that involve changing the location of a folder, such as Copy or Move, only change the location within the current web you cannot change the location of a folder from the current web to a different web.

Using the WebFolders Object

Use WebFolders(index), where index is the index number of an item in the WebFolders collection, to return a single WebFolder object. The following example returns the first WebFolder object in the collection.

Set myFolder = ActiveWeb.RootFolder.Folders(0)

Use the Add method to add a new WebFolder object to the WebFolders collection in a web. Both of the following statements add a WebFolder to the collection of WebFolders in the active web—parentheses are not required for the folder name, as shown in the second statement.

Note The FolderUrl argument within the quotes ("Rogue Cellars") should only include the new folder name, not the entire URL, unless you are adding a new URL to the location designated as the FolderUrl. The program will fail if the entire URL is included for existing URLs.

ActiveWeb.RootFolder.Folders.Add ("Rogue Cellars")
ActiveWeb.RootFolder.Folders.Add "Rogue Cellars"

Use the Count property to return the number of total navigation nodes in the WebFolders collection. The following statement returns the number of webs in the Rogue Cellars web.

Webs("C:\Web Server One\Rogue Cellars").Folders.Count

Use the Delete method to delete a WebFolder object from the collection of WebFolders. The following statements delete the tenth WebFolder object. The second statement uses the name of the folder instead of the index number to designate the folder to delete.

ActiveWeb.RootFolder.Folders(9).Delete
ActiveWeb.RootFolder.Folders("TempFolder").Delete

Use the Copy method to copy a WebFolder object. The following example copies a folder (WebFolders(4)) to another folder on the active web (Chardonnay Inventory). For purposes of this example, WebFolders(4) is a folder in the Rogue Cellars web named Inventory. This folder contains the entire wine inventory—but the web designer wanted to feature the sale on Chardonnay wines, and so created a temporary folder that will be edited to contain only Chardonnay wine.

Private Sub CopyInventory()
    Dim myFolder As WebFolder

    Set myFolder = ActiveWeb.RootFolder.Folders(4)

    myFolder.Copy ("C:\Rogue Cellars\Chardonnay Inventory, False, True)
End Sub

Use the Move method to move a folder from one location in a web to another. For example, if you had old advertising pages that you wanted to keep for the next quarter's sale, you could move them to another folder, as shown in the following example.

Private Sub MoveOldAds()
    Dim myOldAds As WebFolder

    Set myOldAds = Webs(0).RootFolder.Folders(1)

    myOldAds.Move("C:\Rogue Cellars\FirstQtr Advertising", True, True)
End Sub

Use the Parent property when you want to return the container for the WebFolders collection. The following statement returns the container for the fourth folder.

myParent = Webs.RootFolder.Folders(3).Parent


Webs Collection Object

Application
Webs

A collection of WebEx objects. Each WebEx object represents a web on a Web server which can either be disk-based (on a local hard drive) or server-based. The WebEx object is a member of the Webs collection.

Using the Webs Collection

Use the Webs property to return the Webs collection. You can also use the Application property to returns the Application object. The following statement uses the Application object to return the first item in the Webs collection or use the second statement to return the entire collection of webs.

Set myWebOne = Application.Webs(0)
Set myWebs = Application.Webs

Use Webs(index), where index is the index number of an item in the Webs collection, to return a single WebEx object. The following statement returns the third web in the collection of open WebEx objects.

Set myGetWebThree = Webs(2)

Use the Add method to add an item to the list of available items in the Webs collection. The following statement adds the Rogue Cellars web to the Webs collection.

Webs.Add("C:\My Documents\My Webs\Rogue Cellars")

Use the Application property to return information about the application from within the Webs collection. The following statement returns the version number of the Application object.

ActiveWeb.Webs.Application.Version

Use the Count property to return the number of open webs in the Webs collection. The following statement returns the number of open webs.

Webs.Count

Use the Delete method to permanently delete a web from the Webs collection. The following statement deletes the Rogue Cellars web.

Webs.Delete("C:\My Documents\My Webs\Rogue Cellars")

Use the Open method to open a web. The following statement opens a web and adds it to the collection of items in the Webs collection.

Webs.Open("C:\My Documents\My Webs\Rogue Cellars")

Use the Parent method when you want to return the container of the Webs collection, which is the application. The following statement returns the Application object.

Set myParent = Webs.Parent


WebWindowEx Object

WebWindows
WebWindowEx
PageWindows

Represents a window that is opened on a Microsoft FrontPage web. The WebWindowEx object is a member of the WebWindows collection. The WebWindows collection represents all of the open windows in a specified web or in FrontPage. Within the WebWindows collection, individual WebWindowEx objects are indexed beginning with zero. Each web that is opened in FrontPage is contained in a new WebWindowEx object, unless it is opened in a windowless environment by setting the Visible property of the WebWindowEx object to False. For more information on windowless environments, see Coding in a Windowless Environment.

Using the WebWindow Object

Use the WebWindow property to return information about an open WebWindowEx object. You can also use the PageWindows property to return information about the collection of open pages in a WebWindowEx object. Use WebWindows(index), where index is the index number of a web window item, to return a single WebWindow object. The following statement returns the ViewMode property of the first web window item in the WebWindows collection.

myViewMode = WebWindows(0).ViewMode

You can also use the ViewMode property to switch between view modes by setting the view mode as shown in the following statement, which switches the current view mode to the Navigation view.

ActiveWebWindow.ViewMode = fpWebViewStructure

The Activate method puts the focus on the specified WebWindowEx object. The following statements activates the first web in the collection of open web windows.

myWebWindow = WebWindows(0)
myWebWindow.Activate

The ActivePageWindow property returns the active PageWindowEx object. The following statements return the URL and the caption of the active PageWindowEx object. The value returned for the caption in this case is a file name, such as "Index.htm".

urlThisDoc = WebWindow.ActivePageWindow.Document.Url
fileName = WebWindow.ActivePageWindow.Caption

You can also return the Caption property from the WebWindowEx object. In this case the text that is returned reflects the text in the title bar of the FrontPage application window, which consists of the application name and the URL of the specified WebWindowEx object, such as "Microsoft FrontPage – C:\MyWebs\Adventure Works". The following statement returns the value of the Caption property of the WebWindowEx object.

thisCaption = WebWindow.Caption

Use the Close method to close a WebWindowEx object. The following statement closes the specified WebWindow.

Set myWebWindowOne = WebWindows(0)
myWebWindowOne.Close

Use the ViewMode property to return or set one of the values shown in the following table. You can also use these enumerated values to switch views in FrontPage.

Enumermated Constant | Value | Corresponding View in FrontPage
FpWebViewLinks | 0 | Hyperlinks view
FpWebViewFolders | 1 | Folders view
FpWebViewStructure | 2 | Navigation view
FpWebViewPage | 3 | Page view
fpWebViewAllFiles | 4 | View a list of every file in Reports view
FpWebViewTodo | 5 | View a To Do list in Tasks view
FpWebViewBrokenLinks | 6 | View a list of broken hyperlinks in Reports view
FpWebFiewSiteSummary | 7 | Site Summary view in Reports view

The following statement sets the ViewMode property to fpWebViewPage.

WebWindows(0).ViewMode = fpWebViewPage

Use the Visible property to return or set a boolean value for the state of a WebWindowEx object. The Visible property returns True if a WebWindowEx object is visible. The following statement sets a WebWindowEx object to an invisible state.

WebWindow.Visible = False

Use the Web property to return information about the WebEx object. The following statement returns the number of properties for the specified web.

myProperties = ActiveWeb.WebWindows(0).Web.Properties.Count


WebWindows Collection Object

Multiple objects
WebWindows

A collection of WebWindowEx objects. Each WebWindow object represents an open window in Microsoft FrontPage. The WebWindowEx object is a member of the WebWindows collection.

Using the WebWindows Collection

Use Items(index), where index is the index number of an item in the WebWindows collection, to return a single WebWindowEx object. The following example returns the Caption property for the fourth item in the WebWindows collection.

Function ReturnWebWindowCaption() As String
    Dim myCaption As String
    Dim myWebWindow As WebWindowEx

    Set myWebWindow = Application.WebWindows(3)
    myCaption = myWebWindow.Caption
    ReturnWebWindowCaption = myCaption
End Sub

Use the WebWindows property to return the WebWindows collection. The following example closes all of the open WebWindowEx objects in the WebWindows collection except the ActiveWebWindow object.

Private Sub CloseWebWindows
    Dim myWebWindows As WebWindows
    Dim myWebWindow As WebWindowEx
    Dim myActiveWebWindow As WebWindowEx

    Set myWebWindows = Application.WebWindows
    Set myActiveWebWindow = ActiveWebWindow

    For Each myWebWindow In myWebWindows
        If myWebWindow.Caption <> myActiveWebWindow.Caption Then _
            myWebWindow.Close
    Next
End Sub

Use the Application property to return the Application object. If you're already working with the WebWindows collection and you'd like to check the version number of the application, you can easily access it through your With myWebWindows statement as shown in the following example.

With myWebWindows
    myWebWindowCount = myWebWindows.Count
    myAppVersion = .Application.Version
    If myAppVersion < "4.0" Then
        MsgBox "Please upgrade your FrontPage software."
    Else
        For Each myWebWindow In myWebWindows
            myCaption = myWebWindow.Caption
            With myPageWindows
                myPageCount = PageWindows.Count
            End With
        Next
    End If
End With

You can use the Close method to close an individual WebWindowEx object, multiple WebWindowEx objects, or all WebWindowEx objects in a web. For more details on the Close method, see the usage described in the following table.

Important FrontPage will close the application if you use the Close method to close all WebWindowEx objects in FrontPage.

Close Method Usage | Code
Close an individual WebWindowEx object in the application
Application.WebWindows(index).Close

or
Application.WebWindows.Close(index)
Close multiple WebWindowEx objects in the application (as shown in the previous example)
For Each myWebWindow In myWebWindows

    If myWebWindow.Caption <> _
        myActiveWebWindow.Caption Then _
        myWebWindow.Close
Next
Close all WebWindowEx objects in the application
Application.WebWindows.Close
Close an individual WebWindowEx object in a web
Webs(index).WebWindows(index).Close
Close multiple WebWindowEx objects in a web
Set myWeb = Web(index).WebWindows

For Each myWebWindow In myWebWindows
    If myWebWindow.Caption _
      <> myActiveWebWindow.Caption Then _
        myWebWindow.Close
Next
Close a collection in a web
Webs(index).WebWindows.Close
Closing all WebWindowEx objects in FrontPage functions the same as the Quit method | The expression, Application.WebWindows.Close is the same as, Application.Quit.

Use the Count property to return the number of WebWindowEx objects in the collection. The following example returns the number of WebWindowEx objects.

Web.WebWindows.Count

Use the Parent property when you want to return the container for the WebWindows collection. The following statement returns the Application object.

Application.WebWindows.Parent.Name


Activate Method

Activates the specified PageWindowEx, WebEx, or WebWindowEx object. With multiple objects open, you can use the Activate method to work with a specific PageWindowEx, WebEx, or WebWindowEx object.

expression.Activate

expression An expression that returns a PageWindowEx, WebEx, or WebWindowEx object.

Remarks

The Activate method has no effect on a windowless PageWindowEx object.

Example

This statement activates the home page for the Adventure Works Web site.

If myWeb.Url = "C:\My Webs\Adventure Works" Then myWeb.Activate


Add Method

Add method as it applies to the Lists object.

Adds a new List object to the Lists collection.

expression.Add(Name, ParentFolder, ListType, Description)

expression Required. An expression that returns a Lists object.

Name Required. A String that represents the name of the new list.

ParentFolder Optional. A String that represents the parent folder associated with the List.

ListType Optional. An FpListType constant that represents the type of list.

FpListType can be one of these FpListType constants.
fpListTypeBasicList default
fpListTypeDocumentLibrary
fpListTypeSurvey

Description Optional. A String that represents a description of the List object.

Add method as it applies to the ListFields object.

Adds a new ListField object to the ListFields collection.

expression.Add(Name, Description, FieldType, Required, DefaultValue)

expression Required. An expression that returns one of the above objects.

Name Required A String that represents the name of the field.

Description Optional A String that represents a description of the field.

DefaultValue Optional. A Variant that defines the default value.

FieldType Optional. An FpFieldType constant that represents the type of the new field.

FpFieldType can be one of these FpFieldType constants.
fpFieldChoice
fpFieldComputed
fpFieldCounter
fpFieldCurrency
fpFieldDateTime
fpFieldFile
fpFieldInteger
fpFieldLookup
fpFieldMultiLine
fpFieldNumber
fpFieldSingleLine default
fpFieldTrueFalse
fpFieldURL
fpFieldUser

Required Optional. A Boolean that determines if this is a required field. True if the field is required.

Add method as it applies to the NavigationNodes object.

Adds a new file to the list of available items in the NavigationNodes collection. Use this method to add a new file to the navigation structure. For more information on using navigation nodes, see the RootNavigationNode property for the Web object, or the Children property for the NavigationNode object.

expression.Add(Url, NodeLabel, ModificationType, LeftSibling)

expression Required. An expression that returns a NavigationNodes collection.

Url Required String. A string that contains the path for the Web server where the file will be stored. This can be any absolute URL, such as http://web server or file://file system for disk-based webs.

NodeLabel Required String. A string of text used to identify the NavigationNode object when viewing the navigation structure in Navigation view. The NodeLabel argument is used only as an aid to identification.

ModificationType Required FpStructModType. The node modification type.

FpStructModType can be one of these FpStructModType constants.
fpStructBaseOnSibling Use this setting if you want to add a new node to the right of the node designated in the left sibling argument.
fpStructLeftmostChild The leftmost node in the current navigation structure.
fpStructRightmostChild The rightmost node in the current navigation structure.

LeftSibling Optional Variant. An index into the NavigationNodes collection. It can be either a string that represents a URL, or a number that represents a node in the collection.

Remarks

Adding a new file onto the Web server (using the WebFiles.Add method) doesn't imply that you are automatically introducing the file into the navigation structure. A NavigationNode object must be created separately for the file. To create a new NavigationNode object, use the Add method for the NavigationNodes collection.

Note When a template is used to create a new web, navigation nodes are automatically created for the files that have been added to the web by the template.

Add method as it applies to the PageWindows object.

Adds a new PageWindowEx object to the list of available open items in the PageWindows collection.

Note Opening a new or existing file object by using the Add method for the PageWindowEx object also adds the PageWindowEx object that is associated with the opened file to the PageWindows collection.

expression.Add(FileUrl)

expression Required. An expression that returns a PageWindows collection object.

FileUrl Optional String. A string that contains the path for the Web server where the page will be stored. This can be any absolute URL for a file, such as http://web server/file or file://file system/file for disk-based webs.

Remarks

You can use one of three methods when you want to open HTML pages in Microsoft FrontPage page view—the Add, Edit or Open method. When you want to open, edit, then save a file in Page view that exists either on a file server or on a file system on your hard disk, use the Add method for the PageWindows object, as shown in the following statements.

Note It doesn't matter where the files exist; they could reside on a hard disk, server, or a FrontPage web.

Dim myFile As String

myFile = "C:\Adventure Works HTML Files\Hiking.htm"
ActiveWeb.ActiveWebWindow.PageWindows.Add (myFile)

With this method, you haven't added the file to a FrontPage-based web—you've just opened it. If myFile is part of a web, and the web is currently not open, FrontPage will also open the web.

When you want to open and edit an HTML file that exists on a web, use the Edit method for the Files collection in the root folder, as shown in the following statement.

ActiveWeb.RootFolder.Files("Hiking.htm").Edit

You can use the Open method in the same way. However, you should reserve the Open method for opening files that are not HTML files, such as Microsoft Word documents, image files, and so on.

You can also use the Add method to open a new unsaved PageWindow object. You can use either of the following statements to open an unsaved page window.

Set myUnsavedPageWindow = ActiveWebWindow.PageWindows.Add()
Set myUnsavedPageWindow = ActiveWebWindow.PageWindows.Add("")

Note You can use the expression ActiveWebWindow.PageWindows.Add("C:\My Documents\My Webs\index.htm") as a valid expression as long as index.htm is a valid FrontPage-based file that resides in My Webs. However, if index.htm does not reside in My Webs, your code will fail. To add a new page, you must follow the procedure described earlier in this section.

Add method as it applies to the Properties object.

Adds a new property to the list of available items in the Properties collection.

expression.Add(PropertyKey, PropertyValue)

expression Required. An expression that returns the Properties collection.

PropertyKey Required String. A string that contains the name of the property that you want to add. For more information, see the table of properties in the Properties collection topic.

PropertyValue Required Variant. The value of the property.

Remarks

You can programmatically add and remove categories and approval ratings for the Properties collection.

Add method as it applies to the WebFiles object.

Adds a new WebFile object to the list of available items in the WebFiles collection. A WebFile object is not restrictive and can be any type of file, it is not restricted to an HTML file type—it could be an image file, a movie, or an executable file.

Note Use this method to add a new file to a FrontPage-based web.

expression.Add(FileUrl, ForceOverwrite)

expression Required. An expression that returns a WebFiles collection.

FileUrl Required String. A string that contains the URL for the file such as "Inventory.htm". This can be any absolute URL for a file, such as http://web server/file or file://file system/file for disk-based webs.

ForceOverwrite Optional Boolean.

Remarks

Accessing a single WebFile object through the WebFiles collection provides reference to a WebFile object that doesn't have access to the Page object model until the web file is opened. Once the file is open, the PageWindow object associated with the file provides access to the Page object model that is compatible with Microsoft Internet Explorer 4.0 and later. For further information on using the Page object model in your web pages, see Exploring the Object Model in FrontPage.

Add method as it applies to the WebFolders object.

Adds a new WebFolder object to the list of available items in the WebFolders collection.

expression.Add(FolderUrl)

expression Required. An expression that returns a WebFolders collection.

FolderUrl Required String. A string that contains the URL for the folder, such as the Images folder in C:\My Webs. This can be any absolute URL for a folder, such as http://web server/folder or file://file system/folder for disk-based webs.

Add method as it applies to the WebWindows object.

Adds a new WebWindowEx object to the WebWindows collection.

expression.Add(ViewModeEx)

expression Required. An expression that returns a WebWindows collection.

ViewModeEx Required. An FpWebViewModeEx enumerated constant that represents the information displayed in the new window.

FpWebViewModeEx can be one of these FpWebViewModeEx constants.
fpWebViewExAllFiles
fpWebViewExAssignedTo
fpWebViewExBrokenLinks
fpWebViewExBrowserTypes
fpWebViewExCategories
fpWebViewExCheckoutStatus
fpWebViewExComponentErrors
fpWebViewExDailyPageHits
fpWebViewExDailySummary
fpWebViewExFolders
fpWebViewExLinks
fpWebViewExMonthlyPageHits
fpWebViewExMonthlySummary
fpWebViewExNavigation
fpWebViewExOlderFiles
fpWebViewExOsTypes
fpWebViewExPage
fpWebViewExPublishStatus
fpWebViewExRecentlyAddedFiles
fpWebViewExRecentlyChangedFiles
fpWebViewExReferringDomains
fpWebViewExReferringURLs
fpWebViewExReviewStatus
fpWebViewExSearchStrings
fpWebViewExSiteSummary
fpWebViewExSlowPages
fpWebViewExTodo
fpWebViewExUnlinkedFiles
fpWebViewExUsageSummary
fpWebViewExVisitingUsers
fpWebViewExWeeklyPageHits
fpWebViewExWeeklySummary

Add method as it applies to the Webs object.

Adds a new web to the list of available items in the Webs collection.

expression.Add(WebUrl, UserName, Password, WebOpenFlags)

expression Required. An expression that returns a Webs collection object.

WebUrl Required String. A string that contains the path for the Web server where the web will be stored. This can be any absolute URL for a web, such as http://web server or file://file system for disk-based webs.

UserName Optional String. The user's logon name for the Web server.

Password Optional String. The user's password for the Web server.

WebOpenFlags Optional. An FpWebOpenFlags constant that represents the behavior of the new web.

FpWebOpenFlags can be one of these FpWebOpenFlags constants.
fpOpenInWindow default
fpOpenNoWindow

Example

As it applies to the NavigationNodes object.

This example adds a new node called footnote.htm to the list of items in the NavigationNodes collection.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT) and a FrontPage-based file called footnote.htm. Or, you may substitute an alternative web URL or file.

Private Sub AddNewNavNode()
Dim myHome As NavigationNode
Dim myNewNode As NavigationNode
Dim myFileUrl As String

myFileUrl = "C:\My Documents\My Webs\Rogue Cellars\footnote.htm"
Set myHome = ActiveWeb.HomeNavigationNode
Set myNewNode = _
    myHome.Children.Add (myFileUrl, _
    "Footnote", fpStructLeftmostChild)
ActiveWeb.ApplyNavigationStructure
End Sub

As it applies to the PageWindows object.

This example adds the Inventory page for Rogue Cellars winery to the list of items in the PageWindows collection. When you add a page using the FileUrl argument, the page that you want to add must exist as a file—you cannot create a new page using this argument. To create an unsaved new page, refer to the description in the Add method.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT) and a file called Inventory.htm. Or, you may substitute an alternative web URL or file.

Private Sub AddPage()
Dim myPageWindows As PageWindows
Dim myPage As String

Set myPageWindows = ActiveWeb.ActiveWebWindow.PageWindows
myPage = "C:\My Documents\My Webs\Rogue Cellars\Inventory.htm"

myPageWindows.Add (myPage)
End Sub

As it applies to the Properties object.

This example adds a new file to the list of items in the Properties collection.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Windows NT) and a FrontPage-based file called footnote.htm. Or, you may substitute an alternative web URL or file.

Private Sub CopyrightAdd()
Dim myWeb As WebEx
Dim myCopyright As String
Dim myCopyrightProperty As Variant

myCopyright = "Copyright 1999 by Rogue Cellars"
Set myWeb = Webs.Open("C:\My Webs\Rogue Cellers")
myWeb.Activate

ActiveWeb.Properties.Add "Copyright", myCopyright
ActiveWeb.RootFolder.Files("Zinfandel.htm").Open
ActiveDocument.body.insertAdjacentText "BeforeEnd", _
    ActiveWeb.Properties("Copyright")
ActivePageWindow.Save
ActiveWeb.Close
End Sub

As it applies to the Webs object.

This example adds a new item to the list of files in the Webs collection.

Webs.Add ("C:\My Documents\My Webs\Rogue Cellars")

As it applies to the WebFiles object.

This example adds a new WebFile object to the list of items in the Files collection.

ActiveWeb.RootFolder.Files.Add ("C:\New Web Files\Sales Statistics.htm")

As it applies to the WebFolders object.

This example adds a folder to the list of items in the WebFolders collection.

ActiveWeb.RootFolder.Folders.Add ("Distribution Centers")


AddChoice Method

Adds a new choice to the list of available choices for the current field. The field must be of type ListFieldChoice.

expression.AddChoice(text, Index)

expression Required. An expression that returns a ListFieldChoice object.

text Required. A String that represents the text that will appear in the drop-down list or beside a radio button.

Index Optional. A Long that represents the position of the choice within the list of choices.

Example

The following example adds two choices to a choice field named NewChoiceField in the first list of the active web. The new choices are SaleOption, which will appear first in the list, and SaleOption2, which will appear second in the list. The relative positions of the choices is determined by the optional Index argument.

Sub AddChoice()
'Adds choices to the choice field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As listFields
    Dim objFldChoice As ListFieldChoice

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    'Reference new field and add to new choices to the list
    Set objFldChoice = objLstFlds.Item("NewChoiceField")
    objFldChoice.AddChoice text:="SaleOption1", Index:=1
    objFldChoice.AddChoice text:="SaleOption2", Index:=2

End Sub


AddLinkBar Method

Returns a NavigationNode object that represents a link bar.

expression.AddLinkBar(NodeLabel, ModificationType, LeftSibling)

expression Required. An expression that returns a NavigationNodes collection.

NodeLabel Required. A String that represents the label or name of the link bar.

ModificationType Required. An FpStructModType constant that represents the structure of the link bar.

FpStructModType can be one of these FpStructModType constants.
fpStructBaseOnSibling Base the link bar on its closest sibling node.
fpStructLeftmostChild Base the link bar on its leftmost child node.
fpStructRightmostChild Base the link bar on its rightmost child node.

LeftSibling Optional. A Variant that represents the left sibling of the node. This value is used to locate the new link bar in the hierarchy.

Remarks

The new node will not appear in the navigation bar. Only the node's children will appear in the navigation bar.

Note The new link bar must be added to the structure before child nodes can be added to it.

Example

The following example creates a new link bar which is based on its sibling in the hierarchy of navigation nodes.

Sub NewLinkBar()
'Adds a new link bar to the current web

    Dim objApp As FrontPage.Application
    Dim objNavNodes As NavigationNodes
    Dim objNavNode As NavigationNode

    Set objApp = FrontPage.Application
    Set objNavNodes = objApp.ActiveWeb.AllNavigationNodes
    'Reference a node to use in the method
    Set objNavNode = objNavNodes.Item(1)
    'Create new link bar based on sibling
    objNavNodes.AddLinkBar NodeLabel:="New link bar", _
                           ModificationType:=fpStructBaseOnSibling, _
                           LeftSibling:=objNavNode

    'Apply navigation structure so node will appear
    objApp.ActiveWeb.ApplyNavigationStructure

End Sub


ApplyChanges Method

Apply changes to the specified object. Changes to a property of a WebEx, WebFile, or WebFolder object are not applied until you use the ApplyChanges method for the specified object.

expression.ApplyChanges

expression An expression that returns a Properties object.

Example

This example changes the value of the vti_title property for a file called Zinfandel.htm and applies the change.

Private Sub ChangeProperties()
    Dim myProperties As Properties

    Set myProperties = _
        ActiveWeb.RootFolder.Files("Zinfandel.htm").Properties
    myProperties("vti_title") = "Rogue Cellars Wine List"
    myProperties.ApplyChanges
End Sub


ApplyNavigationStructure Method

Apply the navigation structure to the specific object.

expression.ApplyNavigationStructure

expression An expression that returns a WebEx object.

Remarks

There are two details to keep in mind when programmatically creating files and navigation nodes:

  • Navigation labels cannot be empty.
  • Changes to the navigation structure can be lost if you don't apply the navigation structure before starting operations that affect the content of the web such as moving file or folders, and adding files or folders.

Example

This example adds a navigation node as the rightmost child node and then applies the changes to the navigation structure.

Private Sub AddNewNavNode()
    Dim myWeb As WebEx
    Dim myChildNodes As NavigationNodes
    Dim myNewNavNode As NavigationNode

    Set myWeb = ActiveWeb
    Set myChildNodes = _
        myWeb.RootFolder.Files(1).NavigationNode.Children

    myNewNavNode = _
        myChildNodes.Add(myWeb.Url & "Sale.htm", "Sale", _
        fpStructRightmostChild)
    myWeb.ApplyNavigationStructure
End Sub


ApplyTemplate Method

Some of the content in this topic may not be applicable to some languages.

Applies an existing HTML template to the current web.

expression.ApplyTemplate(TemplateDir, fApplyThemes, fOverWrite)

expression Required. An expression that returns one of the objects in the Applies To list.

TemplateDir Required String. The path of the template.

fApplyThemes Optional. A Boolean that determines if the themes in the template will be applied to the new web. If True, the themes will be applied to the web. If False, the themes will not be applied. The default value is False.

fOverWrite Optional. A Boolean that determines if the current template will be overwritten. If True, the current template will be overwritten. If False, the current template will not be overwritten. The default value is False.

Example

The following example adds a specified template to the current web using the ApplyTemplate method. The method is called with the fApplyThemes and the fOverWrite arguments set to False. The themes will not be applied to the new web and any existing template will not be overwritten.

Sub UseTemplate()
'Applies a template to the current web without overwriting the original template
'or applying themes.

    Dim objApp As FrontPage.Application
    Dim objWeb As WebEx
    Dim strPath As String
    Dim strname As String

    Set objApp = FrontPage.Application
    Set objWeb = objApp.ActiveWeb
    'Set variable to template directory.
    strPath = "C:\Program Files\Microsoft Office\Templates\"
    'Prompt the user for the file name of the template
    strname = InputBox("Enter the file name of the template you wish to apply")
    'And the template name and directory to create a full path name
    strPath = strPath & strname
    'Apply the template to the new web
    objWeb.ApplyTemplate TemplateDir:=strPath, _
                         fApplyThemes:=False, fOverWrite:=False

End Sub


ApplyTheme Method

Applies the value contained in the ThemeName argument to the property named in the ThemeProperties argument. For example, a theme can be applied to a WebFile, PageWindowEx, or WebEx object in a Microsoft FrontPage-based web.

expression.ApplyTheme(ThemeName, ThemeProperties)

expression An expression that returns an object in the Applies To list.

ThemeName Required String. A string that contains the name of the theme that you want to apply to a file. ThemeName can be one of the following constants.

artsy | boldstri | indust | sumipntg
blank | capsules | ricepapr |
blends | citrus | rmnsque |
blueprnt | expeditn | strtedge |

ThemeProperties Optional FpThemeProperties. The properties associated with the theme.
FpThemeProperties can be one of these FpThemeProperties constants.
fpThemeActiveGraphics
fpThemeBackgroundImage
fpThemeCSS
fpThemeDefaultSettings
fpThemeName
fpThemeNoBackgroundImage
fpThemeNoCSS
fpThemeNormalColors default
fpThemeNormalGraphics
fpThemePropertiesAll
fpThemePropertiesNone
fpThemeVividColors

Remarks

The following code applies the Sumi Painting theme to a file with active graphics.

Dim strTheme As String

strTheme = "sumipntg"
Call WebFile.ApplyTheme(strTheme, fpThemeActiveGraphics)

To change more than one theme property when applying the theme, use the plus sign (+), as shown in the following example.

strTheme = "sumipntg"
WebFile.ApplyTheme(strTheme, _
fpThemeVividColors + fpThemeActiveGraphics)

This method is essentially the same one you'd use for applying a theme to a PageWindowEx or WebEx object.

Example

This example contains a function, ApplyThemeToFilesInFolder, and a procedure that you can modify to apply any of the available themes. This example applies the Artsy theme to all files in a specified folder.

Note To run this example, copy the code into a module in the Visual Basic Editor and run the ChangeToArtsy procedure.

Function ApplyThemeToFilesInFolder(myThemeName As String, _
        myFolderObject As WebFolder) As Boolean
    Dim myFile As WebFile
    Dim myTheme As Theme

    On Error GoTo ERR

    For Each myFile In myFolderObject.Files
        Call myFile.ApplyTheme(myThemeName, fpThemePropertiesAll)
    Next myFile

    ApplyThemeToFilesInFolder = True
    Exit Function

ERR:
    MsgBox "An error occured: " & ERR.Description, vbCritical, "Error!"
    ApplyThemeToFilesInFolder = False
Exit Function

End Function

Private Sub ChangeToArtsy()
    ApplyThemeToFilesInFolder "artsy", ActiveWeb.RootFolder
End Sub


CancelRequests Method

Immediately cancels all requests to the WebEx object without saving.

expression.CancelRequests

expression An expression that returns a WebEx object.

Example

The CancelRequests method can be used to stop a process that may be taking too long, may appear to be in an infinite loop, or that may be coming from a questionable source.

Private Sub CancelRequestsToWeb_Click()
    Dim myWeb As WebEx

    Set myWeb = ActiveWeb
    myWeb.CancelRequests
End Sub


Checkin Method

Checks the specified WebFile object in to the source control project.

Note You must have a source control project in place before using this method. For information about source control projects, refer to Managing Source Control Projects.

expression.Checkin(Comment, KeepCheckedout)

expression An expression that returns a WebFile object.

Comment Optional String. A description string.

KeepCheckedout Optional Boolean. Keeps the file checked out. Default value is False.

Remarks

The KeepCheckedout argument provides the ability to have the file remain in a checkedout state while the user checks the file in to Microsoft Visual SourceSafe to record the changes. This does not apply to FrontPage Light Weight source control.

Example

The program in this example performs the following steps:

  • Checks out a file and puts the file in edit mode.
  • Adds a welcome message to the document.
  • Checks if the open page has been modified.
  • If the page has been modified, the page is saved.
  • Then the file is closed and checked into the existing source control project.

Note To run this example, you must have a source control project in place on a web with a file called "C:\My Documents\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Windows NT). Or, you may substitute a web and file of your choice.

Private Sub CheckinFile()
    Dim myWeb As WebEx
    Dim myFile As WebFile
    Dim myPageWindow As PageWindowEx
    Dim myWelcome As String

    Set myWeb = Webs("C:/My Webs/Rogue Cellars")
    myWelcome = "Welcome to my Web Site!"
    Set myFile = myWeb.RootFolder.Files("Zinfandel.htm")
    myFile.Checkout
    Set myPageWindow = myFile.Edit(fpPageViewNormal)
    With myPageWindow
            myPageWindow.Document.body.insertAdjacentText("BeforeEnd", _
                myWelcome)
        If myPageWindow.IsDirty = True Then myPageWindow.Save
            .Close
    End With
    myFile.Checkin
End Sub


Checkout Method

Checks the specified WebFile object out to the source control project.

Note You must have a source control project in place before using this method. For information about source control projects, refer to Managing Source Control Projects.

expression.Checkout(ForceCheckout)

expression An expression that returns a WebFile object.

ForceCheckout Optional Boolean. Forces a checkout, even if the file is already checked out. Default value is False.

Remarks

The ForceCheckout argument provides the administrator with the ability to force a checkout in cases where a file has been checked out by a user who is unavailable to check the file back in.

Example

The program in this example performs the following steps:

  • Checks out a file from an existing source control project and puts the file in edit mode.
  • Adds a welcome message to the document.
  • Checks if the open page has been modified.
  • If the page has been modified, the page is saved.
  • Then the file is closed and checked into the existing source control project.

Note To run this example, you must have a source control project in place on a web with a file called "C:\My Documents\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Windows NT). Or, you may substitute a web and file of your choice.

Private Sub CheckoutFile()
    Dim myWeb As WebEx
    Dim myFile As WebFile
    Dim myPageWindow As PageWindowEx
    Dim myWelcome As String

    Set myWeb = Webs("C:/My Webs/Rogue Cellars")
    myWelcome = "Welcome to my Web Site!"
    Set myFile = myWeb.RootFolder.Files("Zinfandel.htm")
    myFile.Checkout
    Set myPageWindow = myFile.Edit(fpPageViewNormal)
    With myPageWindow
            myPageWindow.Document.body.insertAdjacentText("BeforeEnd", _
                myWelcome)
        If myPageWindow.IsDirty = True Then myPageWindow.Save
            .Close
    End With
    myFile.Checkin
End Sub


clear Method

Clears all choices from the current field.

expression.clear

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example clears all choices from any fields of type fpFieldChoice in the first list of the active web.

Sub ClearAllFields()
'Clears all fields from the current list

    Dim objApp As FrontPage.Application
    Dim objList As List
    Dim objListField As Object

    Set objApp = FrontPage.Application
    Set objList = objApp.ActiveWeb.Lists.Item(0)
    'Cycle through fields
    For Each objListField In objList.Fields
        'If field is a choice field then
        If objListField.Type = fpFieldChoice Then
            'Clear all fields
            objListField.Clear
        End If
    Next objListField
    objApp.ActiveWeb.Lists.Item(0).ApplyChanges
End Sub


Close Method

Close method as it applies to the PageWindowEx object.

Closes the specified PageWindowEx object.

expression.Close(ForceSave)

expression Required. An expression that returns one of the above objects.

ForceSave Optional Boolean. True forces the specified file to be saved before the Close method is completed. Default is False.

Close method as it applies to the PageWindows object.

Closes the specified pages in the PageWindows collection, or, if Null, closes all open pages in the PageWindows collection.

expression.Close(Index, ForceSave)

expression Required. An expression that returns one of the above objects.

Index Optional Variant. Refers to an individual item in the PageWindows collection. Can be any number corresponding to an item in the collection, with the index starting at zero.

ForceSave Optional Boolean. True forces the specified file to be saved before the Close method is completed. Default is False.

Close method as it applies to the WebWindows object.

Closes the specified WebWindowEx object.

expression.Close(Index)

expression Required. An expression that returns one of the above objects.

Index Optional Variant. Refers to an item in the WebWindows collection. Can be any number corresponding to an item in the collection, with the index starting at zero.

Close method as it applies to the WebEx and WebWindowEx objects.

Closes the specified object.

expression.Close

expression Required. An expression that returns one of the above objects.

Example

As it applies to the PageWindowEx object.

The following example closes the active page window.

Sub CloseWindow()
'Closes the active page window

    Dim objApp As FrontPage.Application

    Set objApp = FrontPage.Application
    If Not objApp.ActivePageWindow Is Nothing Then
    objApp.ActivePageWindow.Close ForceSave:=True
 End If

End Sub

As it applies to the PageWindows collection.

The following example closes the first page window of the first web in the WebWindows collection.

Sub CloseWindow()
'Closes a page window

    Dim objApp As FrontPage.Application
    Dim objPgeWindows As PageWindows

    Set objApp = FrontPage.Application
    Set objPgeWindows = objApp.ActiveWeb.WebWindows(0).PageWindows
    objPgeWindows.Close Index:=0, ForceSave:=True

End Sub

As it applies to the WebWindows object.

The following example closes all open web windows.

Sub CloseWindow()
'Closes all web windows

    Dim objApp As FrontPage.Application
    Dim objPgeWindows As WebWindows

    Set objApp = FrontPage.Application
    Set objWebWindows = objApp.ActiveWeb.WebWindows
    objWebWindows.Close

End Sub

As it applies to the WebEx and WebWindowEx objects.

The following example closes the active web (if one exists).

Sub CloseWindow()
'Closes the active document

    Dim objApp As FrontPage.Application

    Set objApp = FrontPage.Application
    If Not objApp.ActiveWeb Is Nothing Then
    objApp.ActiveDocument.Close
 End If

End Sub


Copy Method

Copies the specified object to a designated URL. During the copy process you can choose to update hyperlinks or force a file overwrite if the specified object has the same name as the designated object.

expression.Copy(DestinationUrl, UpdateLinks, ForceOverwrite)

expression An expression that returns a WebFile or WebFolder object.

DestinationUrl Required String. The target URL.

UpdateLinks Optional Boolean. Specifies whether links are to be updated during the copy process. True (default) to update links.

ForceOverwrite Optional Boolean. Specifies whether to force a file overwrite when a file or folder is found with the same name. Set the argument to True to force a file overwrite. Default value is False.

Remarks

The Copy method only copies files or folders within the same web. You cannot copy across webs. However, you can use the SaveAs method for the PageWindowEx object to save a page that has its file currently located in one web to save the page to a file in another web. Or, you can use the Add method for the WebFile object to add a file that is currently located in one web to another web.

Example

This example copies a file from the Rogue Cellars web folder to an Inventory folder within the same web.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT).

Private Sub FileCopy()
    Dim myFile As WebFile

    Set myFile = ActiveWeb.RootFolder.Files("Zinfandel.htm")
    myFile.Copy "C:\My Webs\Rogue Cellars\Inventory\Zinfandel.htm"
End Sub


createElement Method

Creates a new IHTMLElement object that represents an HTML element based on the specified argument.

expression.createElement(eTag)

expression Required. An expression that returns a DispFPHTMLDocument object.

eTag Required. A String that represents the new HTML tag type.

Remarks

Only new <IMG> and <OPTION> element tags can be created. Before they can be used, new objects must be explicitly added to their respective collections.

Example

The following example creates a new <P> element. The <P> element corresponds to the HTML paragraph tag.

Sub CreateElement()
'Creates a new element

    Dim objDoc As DispFPHTMLDocument
    Dim objTag As IHTMLElement

    Set objDoc = FrontPage.ActiveDocument
    'Create new tag
    Set objTag = objDoc.CreateElement("P")
    objDoc.body.innerHTML = objDoc.body.innerHTML & objTag.outerHTML

End Sub

The following example creates a new <IMG> tag without creating a new object to reference it.

 Sub NewElement()
 'Creates a new <IMG> element

    Dim objDoc As DispFPHTMLDocument

    Set objDoc = FrontPage.ActiveDocument
    'Create new IMG tag
   objDoc.body.innerHTML = objDoc.body.innerHTML & _
                           objDoc.createElement (eTag:="IMG").outerHTML

End Sub


createStyleSheet Method

Creates or modifies a given cascading style sheet.

expression.createStyleSheet(bstrHref, lIndex)

expression Required. An expression that returns one of the objects in the Applies To list.

bstrHref Optional. A String that represents the path of the cascading style sheet.

lIndex Optional. A Long that specifies the position of the style sheet within the style sheets collection.

Remarks

The createStyleSheet method has optional arguments that change the behavior of the method. The method can be used to create a link to an existing style sheet by specifying a style sheet file path for the bstrHref argument. The createStyleSheet method can be used to modify the existing style sheet by using the active document's style property to access the Style object. Finally, by specifying no arguments, the method can be used to create a new style sheet returning an FPHTMLStyleSheet object.

Example

The following example creates a link from the current document to an existing cascading style sheet. In this scenario, the bstrHref argument specifies the file path of the cascading style sheet.

Sub AddStyleSheet()
'Adds a new style sheet to the document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Create a link to the style sheet
    objDoc.createStyleSheet _
        BstrHref:="C:\Program Files\Microsoft Office\ Office10\1033\PubFtScm\Scheme01.css", _
        lIndex:=1

End Sub

The following example creates a new style sheet and returns it into a variable called "objSS". No arguments are specified.

Sub CreateStyleSheet()
'Creates a new style sheet

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objSS as IHTMLStyleSheet

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Create a style sheet by modifying the current document settings.
    Set objSS = objDoc.CreateStyleSheet

End Sub


createStyleState Method

Returns an IFPStyleState object that represents the properties associated with a given text range.

expression.createStyleState

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the IFPStyleState object and adds a formatted line of text to the active document.

Sub ChangeStyleState()

    Dim objStyleState As IFPStyleState
    Dim objRange As IHTMLTxtRange

    Application.ActiveDocument.body.innerHTML = _
        "Insert New Document Title Here"

    Set objRange = Application.ActiveDocument.body.createTextRange
    Set objStyleState = Application.ActiveDocument.createStyleState
    objStyleState.gather objRange

    objStyleState.fontWeight = 700
    objStyleState.fontFamily = "arial"
    objStyleState.Apply

End Sub


createUndoTransaction Method

Creates an FPHTMLUndoTransaction object that allows you to cancel the specified transaction.

expression.createUndoTransaction(Title)

expression Required. An expression that returns a DispFPHTMLDocument object.

Title Required. A String that specifies the title of the FPHTMLUndoTransaction object.

Example

Use the createUndoTransaction method to create an UndoTransaction object. The following example creates an FPHTMLUndoTransaction object and prompts the user as to whether or not to cancel the operation.

Private Sub CreateTransaction()
    Dim objTrans As FPHTMLUndoTransaction
    Dim objDoc As FPHTMLDocument
    Dim objUTransName As String
    Dim strMsg As String
    Dim strAnswer as String

    Set objDoc = ActiveDocument
    objUTransName = "Undo Last Macro"
    Set objTrans = _
    objDoc.createUndoTransaction(objUTransName)
    strMsg = "Would you like to cancel the operation?"

    Call objDoc.body.insertAdjacentHTML("BeforeEnd", _
        "<b> Added by FP Programmability </b>")

    strAnswer = MsgBox(strMsg, vbYesNo, "Cancel Operation?")
    If strAnswer = vbYes Then
        objTrans.abort
    Else
        objTrans.commit
    End If
End Sub


Delete Method

Delete method as it applies to the NavigationNodes object.

Deletes an individual navigation node from the list of available nodes in the NavigationNodes collection.

expression.Delete(Index)

expression Required. An expression that returns a NavigationNodes object.

Index Optional Variant. Refers to an item in the navigation structure. Can be any number corresponding to an item in the navigation structure, with the index starting at zero.

Delete method as it applies to the Properties object.

Deletes a property from the list of available properties in the Properties collection.

expression.Delete(PropertyKey)

expression Required. An expression that returns a Properties object.

PropertyKey Required String. A string that represents the property name.

Delete method as it applies to the WebEx object.

Deletes a web from the list of available webs in the Webs collection.

expression.Delete(WebDeleteFlags)

expression Required. An expression that returns one of the above objects.

WebDeleteFlags Optional FpWebDeleteFlags. Determines what is deleted from the current web.

FpWebDeleteFlags can be one of these FpWebDeleteFlags constants.
fpDeleteEntireWeb default
fpDeleteFrontPageInfoFromWeb

Delete method as it applies to the WebFiles and WebFolders objects.

Deletes a task from the list of available tasks in the WebFiles collection, or a folder or folders from the list of available folders in the WebFolders collection.

expression.Delete(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. Refers to an item in the WebFiles or WebFolders collection. Can be any number corresponding to an item in the collection, with the index starting at zero.

Delete method as it applies to the Webs object.

Deletes a web from the list of available webs in the Webs collection.

expression.Delete(Index, WebDeleteFlags)

expression Required. An expression that returns a Webs object.

Index Required Variant. Refers to an item in the Webs collection. Can be any number corresponding to an item in the collection, with the index starting at zero.

WebDeleteFlags Optional FpWebDeleteFlags. Determines what is deleted from the current web.

FpWebDeleteFlags can be one of these FpWebDeleteFlags constants.
fpDeleteEntireWeb default
fpDeleteFrontPageInfoFromWeb

Delete method as it applies to all other objects in the Applies To list.

Deletes the specified object from a web.

expression.Delete

expression Required. An expression that returns one of the above objects.

Example

As it applies to the NavigationNodes object.

This example deletes the fourth navigation node of the second file in the active web.

Note You must apply the navigation structure to the web in order for the changes to be applied to the web.

Private Sub DeleteNavNode()
    Dim myWeb As WebEx
    Dim myChildNodes As NavigationNodes

    Set myWeb = ActiveWeb
    Set myChildNodes = _
        myWeb.RootFolder.WebFiles(1).NavigationNode.Children

    Call myChildNodes.Delete(3)
    myWeb.ApplyNavigationStructure
End Sub

As it applies to the Properties object.

This example deletes the SaleText property from the Sales.htm file.

Private Sub DeleteProperty()
    Dim myFile As WebFile
    Dim myProp As String

    Set myFile = ActiveWeb.RootFolder.Files("Sales.htm")
    myFile.Properties.Delete ("SaleText")
End Sub

As it applies to the WebEx object.

This example deletes a temporary web called TempWeb.

Note To run this example, you must have a web called "C:\My Documents\My Webs\TempWeb" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\TempWeb" (for a server running on Windows NT). In either case, you may substitute an alternative web URL.

Private Sub DeleteWeb()
    Dim myWeb As WebEx
    Dim myTempWeb As WebEx
    Dim myFolders As WebFolders
    Dim myFolder As WebFolder
    Dim myWebToDelete As String

    Set myWeb = Webs.Open("C:\My Documents\My Webs")
    Set myFolders = myWeb.RootFolder.Folders
    myWebToDelete = "TempWeb"

    For Each myFolder In myFolders
    If myFolder.IsWeb = True Then
        If myFolder.Name = myWebToDelete Then
            Set myTempWeb = Webs.Open(myFolder.Name)
            myTempWeb.Delete
        End If
    End If
    Next
    ActiveWebWindow.Close
End Sub

As it applies to the WebFiles and WebFolders objects.

This statement deletes a file in the active web.

Note To run this example, you must have a file called "C:\My Documents\My Webs\TempFile.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\TempFile.htm" (for a server running on Windows NT). In either case, you may substitute an alternative web file.

ActiveWeb.RootFolder.Files.Delete "TempFile"

This statement deletes the second folder in the active web.

ActiveWeb.RootFolder.Folders.Delete(1)

As it applies to the Webs object.

This statement deletes the fourth web.

Webs.Delete(3)

As it applies to all other objects in the Applies To list.

This example deletes a file from the active web.

Note To run this example, you must have a file called "C:\My Documents\My Webs\TempFile.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\TempFile.htm" (for a server running on Windows NT). In either case, you may substitute an alternative web file.

Private Sub DeleteFile()
    Dim myFile As WebFile

    Set myFile = ActiveWeb.RootFolder.Files("TempFile")
    myFile.Delete

End Sub

This example deletes a folder from the active web.

Note To run this example, you must have a file called "C:\My Documents\My Webs\TempFolder" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\TempFolder" (for a server running on Windows NT). In either case, you may substitute an alternative web folder.

Private Sub DeleteFolder()
    Dim myFolder As WebFolder

    Set myFolder = ActiveWeb.RootFolder.Folders("TempFolder")
    myFolder.Delete

End Sub


Edit Method

The Edit method is used to open Microsoft FrontPage compatible files in a page window. These files include file formats such as HTML, CSS, ASP. To open files of other types use the Open method.

Note HTML files without extensions will not open with the Edit method.

expression.Edit(ViewMode)

expression An expression that returns a File object.

ViewMode Optional FpPageViewMode.

FpPageViewMode can be one of these FpPageViewMode constants.
fpPageViewDefault default
fpPageViewHtml
fpPageViewNoFrames
fpPageViewNormal
fpPageViewNoWindow
fpPageViewPreview

Example

This example shows how to use the Edit method to open a file for editing.

Note You must have a web open to run this program with a file called RedWines.htm in the web or you may substitute a file of your choice.

Private Sub ModifyFile()
    Dim myFile As WebFile

    Set myFile = ActiveWeb.RootFolder.Files("RedWines.htm")

    myFile.Edit
End Sub


elementFromPoint Method

Given screen coordinates, returns the IHTMLElement object that corresponds to the specified coordinate arguments.

expression.elementFromPoint(x, y)

expression Required. An expression that returns one of the objects in the Applies To list.

x Required. A Long that represents a specified point on the horizontal axis.

y Required. A Long that represents a specified point on the vertical axis.

Remarks

The coordinates correspond to window coordinates (0,0 is the top-left corner of the window). For the elementFromPoint method to exhibit the expected behavior, the object or element located at position (x, y) must support and respond to mouse events.

Example

The following example prompts the user to enter x and y coordinates to specify the location of the element. If an element corresponds to the specified location, the element tag name is displayed. If there is no corresponding element, a message is displayed to the user.

Sub GetElement()
'Returns an HTML element that corresponds to a set of coordinates

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objElement As IHTMLElement
    Dim lngX As Long
    Dim lngY As Long

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user for coordinates.
    lngX = InputBox("Enter the X position of the element you want to select.")
    lngY = InputBox("Enter the Y position of the element you want to select.")
    'Get the element based on the user's coordinates.
    Set objElement = objDoc.elementFromPoint(lngX, lngY)

    'If the search was succesful, display message
    If objElement Is Nothing Then
        MsgBox "The specified coordinates did not return an element."
    Else
        'Otherwise display message
        MsgBox "The element is of type " & objElement.tagName & "."
    End If

End Sub


execCommand Method

Executes a specified command and returns a Boolean that indicates the outcome of the search.

expression.execCommand(cmdID, showUI, value)

expression Required. An expression that returns one of the objects in the Applies To list.

cmdID Required. A String that represents the Command Identifier for the specified argument.

showUI Optional. A Boolean that specifies if the user interface associated with the command will be displayed. The default value is False.

value Optional. A Variant that specifies any additional arguments associated with the cmdID parameter.

Example

The following example deletes the current selection and returns a Boolean that stores the outcome of the command.

Sub ExecCmd()
'Executes a command based on the specified
'parameters

     Dim objApp As FrontPage.Application
     Dim objDoc As DispFPHTMLDocument
     Dim blnSuccess as Boolean

     Set objApp = FrontPage.Application
     Set objDoc = objApp.ActiveDocument
     'Delete the current selection.
     blnSuccess = objDoc.execCommand (cmdID:="Delete")

End Sub

The following example changes the font of the current selection to Arial and returns True if successful. The showUI argument is set to False meaning that the associated user interface will not be displayed.

     blnSuccess = objDoc.execCommand (cmdID:="FontName",
                         _ ShowUI:=False, Value:=arial)


LocateFile Method

Returns the specified WebFile object.

expression.LocateFile(FileUrl)

expression An expression that returns a WebEx object.

FileUrl Required String. Default value is the file portion of the URL.

Example

This example locates a file in the root directory of the web and puts the file in edit mode.

Note You must have a web open and a file called Zinfandel.htm or, you may substitute a file of your choice.

Private Sub LocateAFile()
    Dim myFile As WebFile

    Set myFile = Webs(0).LocateFile("Zinfandel.htm")
    myFile.Edit
End Sub

In most cases, you would probably use the entire URL for the String argument of the LocateFile method. For example, a file may be several levels deep in the folder hierarchy, such as C:/My Documents/My Webs/Rogue Cellars/Inventory/First_Qtr.htm—and you want to locate First_Qtr.htm. Anytime a folder exists in a level deeper than the root directory of the web, use the entire URL as shown in the following example.

Private Sub GetFile()
    Dim myFile As String
    Dim myFileFound As WebFile

    myFile = _
        "C:/My Documents/My Webs/Rogue Cellars/Inventory/First_Qtr.htm"

    Set myFileFound = Webs(0).LocateFile(myFile)
End Sub

However, there is a shortcut. For example, if you want to locate a file in an images folder that resides in the root directory of the web, you can use a web relative address by using a forward slash followed by the subfolder and file name as shown in the following statement.

Set myFileFound = Webs(0).LocateFile("images/JPG/myJPGFileList.htm")

Note You cannot substitute a backslash in a web relative address.


LocateFolder Method

Returns the specified WebFolder object.

expression.LocateFolder(FolderUrl)

expression An expression that returns a WebFolder object.

FolderUrl Required String. Default value is the folder portion of the URL.

Example

This example locates a folder in the root directory of a web.

Note You must have a web open for all of these examples.

Private Sub LocateAFolder()
    Dim myFolderFound As WebFolder

    Set myFolderFound = Webs(0).LocateFolder("images")
End Sub

In most cases, you would probably use the entire URL for the String argument of the LocateFolder method. For example, a folder may be several levels deep in the folder hierarchy, such as C:/My Documents/My Webs/Rogue Cellars/Inventory/First_Quarter—and you want to locate First_Quarter. Anytime a folder exists in a level deeper than the root directory of the web, use the entire URL as shown in the following example.

Private Sub GetFolder()
    Dim myFolder As String
    Dim myFolderFound As WebFolder

    myFolder = _
        "C:/My Documents/My Webs/Rogue Cellars/Inventory/First_Quarter"

    Set myFolderFound = _
        Webs(0).LocateFolder(myFolder)
End Sub

However, there is a shortcut. For example, if you want to locate an images folder that resides in the root directory of the web, you can use a web relative address by using a forward slash followed by the subfolder name as shown in the following statement.

Set myFolderFound = Webs(0).LocateFolder("images/JPG")

Note You cannot substitute a backslash in a web relative address.


LocatePage Method

LocatePage method as it applies to the Application object.

Returns a PageWindowEx object for the specified object.

expression.LocatePage(DocumentUrl, ViewMode)

expression Required. An expression that returns an Application object.

DocumentUrl Required A String that represents the document or file portion of the entire URL. This can be any absolute URL, such as "http://web server/document", "http://web server/file", or "file://file system/document" or "file://file system/file" for disk-based webs. The default value is the file portion of the URL.

ViewMode Optional An FpPageViewMode constant that represents the view mode .

FpPageViewMode can be one of these FpPageViewMode constants.
fpPageViewDefault default
fpPageViewHtml
fpPageViewNoFrames
fpPageViewNormal
fpPageViewNoWindow
fpPageViewPreview

LocatePage method as it applies to the WebEx object.

Returns the PageWindowEx object associated with the current web.

expression.LocatePage(FileUrl, ViewMode)

expression Required. An expression that returns one of the above objects.

FileUrl Required A String that represents the document or file portion of the entire URL.

ViewMode Optional An FpPageViewMode constant that represents the view mode ..

FpPageViewMode can be one of these FpPageViewMode constants.
fpPageViewDefault default
fpPageViewHtml
fpPageViewNoFrames
fpPageViewNormal
fpPageViewNoWindow
fpPageViewPreview

Example

This example locates a page in the root web and a subweb.

Private Sub LocatePages()
    Dim myRootPage As PageWindowEx
    Dim myWebPage As PageWindowEx

    Set myRootPage = _
        Application.LocatePage("Zinfandel.htm", fpPageViewNormal)
    Set myWebPage = _
        Webs(1).LocatePage("Zinfandel.htm", fpPageViewNormal)
End Sub


MakeAbs Method

Changes the Application object to an absolute object rather than a relative object. For more information on absolute and relative URLs, refer to Understanding Absolute and Relative URL Addressing

expression.MakeAbs(UrlBase, Url)

expression An expression that returns a Application object.

UrlBase Required Variant. A base URL. Can be one of the following, a string, or an object of type Web, WebFolder, WebFile, NavvigationNode, or IHTMLDocuemnt2.

Url Required String. A string that contains the entire URL for the web. This can be any URL for a web, such as http://web server/folder or file://file system/folder for disk-based webs.

Example

This example changes a relative URL to an absolute URL.

Note To run this example, you must have a web and a file called "C:\My Documents\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Windows NT). In either case, you may substitute an alternative web URL or file.

Private Sub MakeURLAbsolute()
    Dim myBaseURL As WebEx
    Dim myAbsAddress As String
    Dim myLocalUrl As String

    myBaseURL = Webs.Open("C:\My Webs")
    myLocalUrl = "Zinfandel.htm"

    myAbsAddress = MakeAbs(myBaseURL, myLocalUrl)
End Sub


MakeRel Method

Changes the Application object to a relative object rather than an absolute object. For more information on absolute and relative URLs, refer to Understanding Absolute and Relative URL Addressing

expression.MakeRel(UrlBase, Url)

expression An expression that returns an Application object.

UrlBase Required Variant. A base URL. Can be one of the following, a string, or an object of type WebEx, WebFolder, WebFile, NavvigationNode, or IHTMLDocuemnt2.

Url Required String. A string that contains the entire URL. This can be any URL for a web, such as http://web server/folder or file://file system/folder for disk-based webs.

Example

This example changes an absolute URL to a relative URL, adds a hyperlink to the active document using the relative URL, and then saves the changes to the active page window.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). You must also have two files, one called "Zinfandel.htm" and the other called "index.htm", which has an absolute URL (the default state). Or, you may substitute an alternative web URL and substitute alternative file names.

Private Sub MakeURLRelative()
    Dim myFile As WebFile
    Dim myFile2 As WebFile
    Dim myBaseURL As WebEx
    Dim myDoc As FPHTMLDocument
    Dim myRelAddress As String
    Dim myRelAddress2 As String

    Set myBaseURL = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    Set myFile = myBaseURL.RootFolder.Files("Zinfandel.htm")
    Set myFile2 = myBaseURL.RootFolder.Files("index.htm")
    Set myDoc = myFile.Edit(fpPageViewNormal).Document

    myRelAddress = MakeRel(myBaseURL, myFile2.Url)
    myRelAddress2 = """" & myRelAddress & """"
    Call myDoc.body.insertAdjacentHTML("BeforeEnd", "<a href=" _
            & myRelAddress2 & ">" & myRelAddress & "</a>")
    ActivePageWindow.Save
End Sub


MakeWeb Method

Creates a new web from an existing folder. To create a new web without first creating a folder, see the Add method.

expression.MakeWeb(UserName, Password)

expression An expression that returns a WebFolder object.

UserName Optional String. The logon name of the user. You can use this option to create a default username for the web.

Password Optional String. The password of the user. You can use this option to create a default password for the web.

Example

This example creates a new web from the existing Distributors folder. (The Distributors folder is a folder in the Rogue Cellars web.)

Private Sub MakeWeb()
    Dim myWeb As WebEx
    Dim myFolder As WebFolder

    Set myWeb = Webs("C:\My Webs\Rogue Cellars")
    myWeb.Activate
    Set myFolder = Active.RootFolder.Folders("Distributors")
    myFolder.MakeWeb
End Sub


Move Method

Move method as it applies to the WebFile and WebFolder objects.

Moves the specified object from its current location to a designated URL.

expression.Move(DestinationUrl, UpdateLinks, ForceOverwrite)

expression An expression that returns one of the above objects.

DestinationUrl Required String. The target URL, such as "C:\My Documents\My Webs\Adventure Works".

UpdateLinks Required Boolean. Designate True if links are to be updated during the move process. Default is False.

ForceOverwrite Required Boolean. Designate True if the object should be overwritten when a duplicate object is encountered. Default is False.

Move method as it applies to the NavigationNode object.

Moves a navigation node from one location to another in the navigation structure. Returns a NavigationNode object (the node after it has been moved).

expression.Move(NodeCollection, NewLeftSibling)

expression An expression that returns a NavigationNode object.

NodeCollection Required NavigationNodes. The target navigation collection.

NewLeftSibling Optional Variant. The navigation node that will be the left sibling of the new node in the navigation structure. If it is not specified, the node will be moved to the rightmost end of the NodeCollection.

Example

As it applies to the WebFile object.

The following statement moves a file from one position in the file structure to another .

myFile.Move("C:\My Documents\My Webs\Adventure Works\Images", _
    True, False)

As it applies to the NavigationNode object.

The following example moves a node from the fifth position in the navigation structure to the fourth position in the navigation structure by designating the third node as the new left sibling.

Private Sub MoveNavNode()
 Dim myNodes As NavigationNodes
 Dim myNode As NavigationNode

    Set myNodes = ActiveWeb.RootNavigationNode.Children
    Set myNode = myNodes(4)

    myNode.Move(myNodes,2)
    ActiveWeb.ApplyNavigationStructure

End Sub


OnTime Method

Starts a background timer that runs a macro on the specified date at the specified time.

expression.OnTime(When, Name, Tolerance)

expression Required. An expression that returns an Application object.

When Required Variant. The time at which the macro is to be run. Can be a string that specifies a time (for example, "4:30 pm" or "16:30"), or it can be a serial number returned by a function such as TimeValue or TimeSerial (for example, TimeValue("2:30 pm") or TimeSerial(14, 30, 00)). You can also include the date (for example, "6/30 4:15 pm" or TimeValue("6/30 4:15 pm")).

Use the sum of the return values of the Now function and either the TimeValue or TimeSerial function to set a timer to run a macro a specified amount of time after the statement is run. For example, use Now+TimeValue("00:05:30") to run a macro 5 minutes and 30 seconds after the statement is run.

Name Required String. The name of the macro to be run. Use the complete macro path to ensure that the correct macro is run (for example, "Project.Module1.Macro1"). For the macro to run, the document or template must be available both when the OnTime method is run and when the time specified by When arrives.

Tolerance Optional Variant. The maximum time (in seconds) that can elapse before a macro that wasn't run at the time specified by When is canceled. Macros may not always run at the specified time. For example, if a dialog box is being displayed, the macro will be delayed until Microsoft FrontPage has completed the task. If this argument is 0 (zero) or omitted, the macro is run regardless of how much time has elapsed since the time specified by When.

Remarks

Microsoft FrontPage can maintain only one background timer set by the OnTime method. If you start another timer before an existing timer runs, the existing timer is canceled.

Example

This example runs the macro named "Macro1" in the current module at 3:55 P.M.

Application.OnTime When:=Timevalue("15:55:00"), Name:="Macro1"

This example runs the macro named "Macro1" 15 seconds from the time the example is run. The macro name includes the project and module name.

Application.OnTime When:=Now + TimeValue("00:00:15"), _
    Name:="Project1.Module1.Macro1"

This example runs the macro named "Start" at 1:30 P.M. The macro name includes the project and module name.


Open Method

Open method as it applies to the WebFile object.

Opens a WebFile object.

expression.Open

expression Required. An expression that returns one of the above objects.

Open method as it applies to the Webs object.

Returns a WebEx object.

expression.Open(szWebUrl, UserName, Password, WebOpenFlags)

expression Required. An expression that returns one of the above objects.

szWebUrl Required String. The base URL of the web, such as "C:\My Webs". This can be any absolute URL, such as "http://web server" or "file://file system" for disk-based webs.

UserName Optional String. The logon name of the user.

Password Optional String. A designated string of characters to validate access to the specified web.

WebOpenFlags Optional FpWebOpenFlags.

FpWebOpenFlags can be one of these FpWebOpenFlags constants.
fpOpenInWindow default
fpOpenNoWindow

Example

This example opens the Rogue Cellars web and the Oktoberfest Sale file, and performs the following tasks:

  • Adds text to the file by creating a property to hold the text
  • Accesses the Page object model using the ActiveDocument property and the insertAdjacentText method
  • Adds text to the page by substituting mySaleProp for the text parameter in the insertAdjacentText method
  • Closes Microsoft FrontPage

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT), or you may substitute an alternative web URL and file.

Private Sub AddSaleText()

    Dim objWeb As Web
    Dim objFile As WebFile
    Dim strSaleProp As String
    Dim strSaleText As String

    strSaleText = "Vintage Wines for Oktoberfest Sale!!!"
    Set objWeb = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    Set objFile = ActiveWeb.RootFolder.Files("Sale.htm")

    objFile.Properties.Add "SaleText", mySaleText
    strSaleProp = objFile.Properties("SaleText")
    objFile.Open
    ActiveDocument.body.insertAdjacentText "BeforeEnd", strSaleProp
    WebWindows.Close

End Sub


ParseURL Method

Returns or sets a String that represents an FpURLComponent of the given URL. The FpURLComponent corresponds to a portion of the URL that signifies the location of the file.

expression.ParseURL(Url, URLComponent)

expression Required. An expression that returns an Application object.

Url Required String. The URL to be parsed.

URLComponent Required FpURLComponent. The component of the URL to be returned by the method.

FpURLComponent can be one of these FpURLComponent constants.
fpURLComponentBookmark
fpURLComponentFileExtension
fpURLComponentFileName
fpURLComponentPassword
fpURLComponentPath
fpURLComponentPort
fpURLComponentQuery
fpURLComponentScheme
fpURLComponentServer
fpURLComponentUserName

Example

The following example retrieves the file name from the URL, using the fpURLComponentFileName argument, and displays it to the user.

Sub FrontPageParseURL()
'Parses the URL into its components

    Dim objApp As FrontPage.Application
    Dim strURL As String
    Set objApp = FrontPage.Application
    'Parse the URL and retrieve the filename component
    strURL = objApp.ParseURL("file:///D:/Documents and Settings/UserName/My Documents/My Webs/Index.htm", _
                             fpURLComponentFileName)
    'Display the message to the user.
    MsgBox "The filename is " & strURL & "."
End Sub


Publish Method

Publishes a web to a Web server, whether on a server running Microsoft Internet Information Services (IIS) or on a Personal Web Server.

expression.Publish(DestinationUrl, PublishFlags, UserName, Password)

expression An expression that returns a WebEx object.

DestinationUrl Required String. A string that contains the entire target URL for the web, such as “http://wwwroot/Adventure Works”. This can be any URL for a web, such as http://web server/folder or file://file system/folder for disk-based webs.

PublishFlags Optional FpWebPublishFlags.

FpWebPublishFlags can be one of these FpWebPublishFlags constants.
fpPublishAddToExistingWeb
fpPublishCopyAllFiles
fpPublishCopySubwebs
fpPublishIncremental
fpPublishLogInTempDir
fpPublishNoDeleteUnmatched
fpPublishUseLastPublishTime
fpPublishNone default

UserName Optional String. The name of the user who is publishing the web.

Password Optional String. The password of the user.

Example

This example publishes the active web.

Note If the web you are publishing to is an existing web, you must use the argument fpPublishAddToExistingWeb, otherwise your web won't be published. If the web you are publishing to doesn't exist, don't use the fpPublishAddToExistingWeb argument because you're web won't be published.

Private Sub PublishMyWeb()
    Dim myWeb As WebEx
    Dim myBaseURL As String
    Dim myPublishParam As FpWebPublishFlags

    Set myWeb = Application.ActiveWeb
    myBaseURL = "http://www.Adventure-Works.com"
    myPublishParam = fpPublishAddToExistingWeb
    myWeb.Publish myBaseURL, myPublishParam
End Sub


queryCommandEnabled Method

Returns a Boolean that indicates if the specified command can be executed. Whether or not a command can be executed is based on the current state of the document. For more information on the state of the current document, see the document's readyState property.

expression.queryCommandEnabled(cmdID)

expression Required. An expression that returns one of the objects in the Applies To list.

cmdID Required. A String that represents the command identifier.

Example

The following example prompts the user to enter a command identifier. The queryCommandEnabled method is executed using the user input and a message is displayed to the user depending on the result of the method.

Sub QueryCommand()
'Determines if a command can be executed
'based on the document state.

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user to enter command name.
    strUser = InputBox("Enter a command identifier to be executed.")
    'Attept to run the associated command
    If objDoc.queryCommandEnabled(cmdID:=strUser) = True Then
        'If yes - display message.
        MsgBox "The command " & strUser & " can be executed."
    Else
        'If no - display message.
        MsgBox "The command " & strUser & " cannot be executed."
    End If

End Sub


queryCommandIndeterm Method

Returns a Boolean that determines if the specified command will return an indeterminate state. An indeterminate state means that the command could not return a binary result with the specified parameter. For example, the Bold command will return indeterminate if the current selection contains both bolded and non-bold text. If True, the command will return an indeterminate result. If False, the command will return a binary result.

expression.queryCommandIndeterm(cmdID)

expression Required. An expression that returns a DispFPHTMLDocument object.

cmdID Required. A String that represents the specified command identifier.

Example

The following example prompts the user to enter a command identifier to determine if the specified command will return an indeterminate state. A message is displayed to the user based on the result of the method.

Sub QueryCommand()
'Determines if a command will return an
'indeterminate state

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user to enter command name.
    strUser = InputBox("Enter a command identifier to be executed.")
    'Run the associated command

    If objDoc.queryCommandIndeterm(cmdID:=strUser) = True Then
        'If yes - display message.
        MsgBox "The command " & strUser & _
               " will return an indeterminate state."
    Else
        'If no - display message.
        MsgBox "The command " & strUser & _
               " will not return an indeterminate state."
    End If

End Sub


queryCommandState Method

Returns a Boolean that indicates the state of the specified command. If True, the specified command has already been carried out on the current selection. If False, the specified command has not yet been carried out on the current selection.

expression.queryCommandState(cmdID)

expression Required. An expression that returns a DispFPHTMLDocument object.

cmdID Required. A String that specifies the command identifier.

Remarks

This method returns Null if the state of the current selection could not be determined.

Example

The following example prompts the user for a command identifier and displays a message based on the result of the method.

Sub QueryCommand()
'Determines whether a command has been carried out

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user to enter command name.
    strUser = InputBox("Enter a command identifier to be executed.")
    'Run the associated command, checks command status and displays results.
    If objDoc.queryCommandState(cmdID:=strUser) = True Then
        MsgBox "The command " & strUser & _
               " has already been carried out."
    Else
        MsgBox "The command " & strUser & _
               " has not yet been carried out."
    End If

End Sub


queryCommandSupported Method

Returns a Boolean that indicates if the specified command is supported by the current selection.

expression.queryCommandSupported(cmdID)

expression Required. An expression that returns one of the objects in the Applies To list.

cmdID Required. A String that represents the specified command identifier.

Example

The following example prompts the user to enter a command identifier. A message is displayed to the user depending on the result of the command.

Sub QueryCommand()
'Determines whether a command is supported
'by the current selection

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user to enter command name.
    strUser = InputBox("Enter a command identifier to be executed.")
    'Run the associated command
    If objDoc.queryCommandSupported(cmdID:=strUser) = True Then
        'If yes - display message.
        MsgBox "The command " & strUser & _
               " is supported by the current selection."
    Else
        'If no - display message.
        MsgBox "The command " & strUser & _
               " is not supported by the current selection."
    End If

End Sub


queryCommandText Method

Returns a String that represents a text value associated with the specified command.

expression.queryCommandText(cmdID)

expression Required. An expression that returns a DispFPHTMLDocument object.

cmdID Required. A String that represents the command identifier.

Example

The following example displays the text value associated with a given command.

Sub QueryCommand()
'Determines the value of a specified command

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String
    Dim strValue As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user to enter command name.
    strUser = InputBox("Enter a command identifier to be executed.")
    'Run the associated command.
    strValue = objDoc.queryCommandText(strUser)
    MsgBox "The text value associated with the specified command is: " & strValue
End Sub


queryCommandValue Method

Returns a String that indicates the value of the specified command.

expression.queryCommandValue(cmdID)

expression Required. An expression that returns one of the objects in the Applies To list.

cmdID Required. A String that represents the command identifier.

Example

The following example displays the current value of the specified command.

Sub QueryCommand()
'Determines the value of a specified command

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String
    Dim strValue As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt user to enter command name.
    strUser = InputBox("Enter a command identifier to be executed.")
    'Run the associated command.
    strValue = objDoc.queryCommandValue(strUser)
    MsgBox "The value of the command is: " & strValue
End Sub


Quit Method

Quits the application. This method does not save any changes that have not been previously saved using the Save or SaveAs commands, but immediately exits the active application.

expression.Quit

expression An expression that returns an Application object.

Example

This example quits the application without saving any changes that were made since the previous Save or SaveAs commands were executed.

Private Sub QuitApp()
    Application.Quit
End Sub


RecalcHyperlinks Method

Recalculates all meta data on the server for this web. This operation will rebuild FrontPage’s knowledge of all hyperlinks, titles for web pages, themes on pages, and so on.

Note This operation may take a long time to complete depending on the amount of meta data on the server.

expression.RecalcHyperlinks

expression An expression that returns a WebEx object.

Example

This example recalculates the hyperlinks for the active web.

Private Sub RecalcLinks()
    Dim myWeb As WebEx

    Set myWeb = Application.ActiveWeb

    myWeb.RecalcHyperlinks
End Sub


Refresh Method

Refresh method as it applies to the WebEx object.

Refreshes the specified WebEx object.

expression.Refresh(FetchAll)

expression Required. An expression that returns one of the above objects.

FetchAll Optional Boolean. True to retrieve all information for all documents regardless of view. When set to False this argument retrieves only the information necessary to support the current view. However, if Reports or Hyperlink view is open, False refreshes all documents. Default is False.

Refresh method as it applies to the PageWindowEx object.

Refreshes the specified PageWindowEx object with an option to save changes.

expression.Refresh(SaveChanges)

expression Required. An expression that returns one of the above objects.

SaveChanges Optional Boolean. True to save changes.

Example

The following statements refresh the active page window and the first page window of the first web.

ActivePageWindow.Refresh
WebWindows(0).PageWindows(0).Refresh

you can use the following statement to save any changes you may have made to the page.

ActivePageWindow.Refresh(True)

You can use the following statements to refresh the active web and the first web.

ActiveWeb.Refresh
Webs(0).Refresh


RemoveChoice Method

Removes the specified choice from the current field.

expression.RemoveChoice(Index)

expression Required. An expression that returns one of the objects in the Applies To list.

Index Required. A Long that represents the name of the choice or its position within the array.

Example

The following example removes the first choice from the NewChoiceField field in the first list of the active web.

Sub RemoveChoice()
'Removes first choice from array

    Dim objApp As FrontPage.Application
    Dim objListFields As listFields
    Dim objListField As ListFieldChoice

    Set objApp = FrontPage.Application
    Set objListFields = objApp.ActiveWeb.Lists.Item(0).Fields
    Set objListField = objListFields.Item("NewChoiceField")
    'Remove first choice in list
    objListField.RemoveChoice Index:=0

End Sub


RemoveWeb Method

Removes the WebEx object from the specified WebFolder object.

expression.RemoveWeb(UserName, Password)

expression An expression that returns a WebFolder object.

UserName Optional String. The logon name of the user.

Password Optional String. The password of the user.

Remarks

The RemoveWeb method is the complement of the MakeWeb method. Just as the MakeWeb method creates the meta data for the web from a folder, the RemoveWeb method removes the meta data for the web from a folder, but the folder remains intact. This is different from the Delete method for the WebEx object, where the entire contents of the specified web are removed.

Example

This example removes a web from a folder. The folder and its contents remain intact, but the folder is no longer a web.

Note You must have the web that contains the folder open.

Private Sub WebRemove()
    Dim myFolders As WebFolders
    Dim myFolder As WebFolder

    Set myWebFolders = Webs(0).RootFolder.Folders

    For Each myFolder In myFolders
        If myFolder.Name = "TempWeb" Then
            myFolder.RemoveWeb
            Exit For
        End If
    Next
End Sub


Run Method

Runs the designated Microsoft Visual Basic macro. You can use the Run method to execute a specified procedure in Microsoft FrontPage. You can also use the Run method from within the procedure of an ActiveX control that carries out instructions to query or modify a FrontPage-based web.

Note You cannot pass parameters to a procedure using the Run method. Use the Call statement to pass parameters to a procedure.

expression.Run(MacroName, safeArrayOfParams)

expression An expression that returns an Application object.

MacroName Required String. The name of the macro, add-in, or script.

safeArrayOfParams Required. A ParamArray of type Variant.

Example

This example runs a macro from another procedure.

Note To run this example, you must have a web named Rogue Cellars or you can substitute a different web in place of the Rogue Cellars web. Copy the following procedures into a code module and run StartMacro.

Private Sub StartMacro()
    Dim myMacro As String

    myMacro = "OpenRogueCellars"
    Run (myMacro)
End Sub

Sub OpenRogueCellars()
    Dim myWeb As Web

    Set myWeb = Webs.Open("C:\My Webs\Rogue Cellars")
End Sub


Save Method

Saves a PageWindowEx object.

expression.Save(ForceOverwrite)

expression An expression that returns a PageWindowEx object.

ForceOverwrite Optional Boolean. The ForceOverwrite argument can be used to write over an existing file. The default value is True.

Example

This example creates a property, adds it to a file, and then saves the active page window.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\My Webs\Rogue Cellars" (for a server running on Windows NT), or you may substitute an alternative web URL and file.

Private Sub AddSaleText()
    Dim myWeb As WebEx
    Dim myFile As WebFile
    Dim mySaleProp As String
    Dim mySaleText As String

    mySaleText = "Vintage Wines for Oktoberfest Sale!!!"
    Set myWeb = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    Set myFile = ActiveWeb.RootFolder.Files("Sale.htm")

    myFile.Properties.Add "SaleText", mySaleText
    mySaleProp = myFile.Properties("SaleText")
    myFile.Open
    ActiveDocument.body.insertAdjacentText "BeforeEnd", mySaleProp
    ActivePageWindow.Save
    WebWindows.Close
End Sub


SaveAs Method

Writes the specified PageWindowEx object to the destination URL.

expression.SaveAs(DestinationUrl, ForceOverwrite)

expression An expression that returns a PageWindowEx object.

DestinationUrl Required String. A string that contains the entire URL for the web, such as “C:\My Documents\My Webs\Adventure Works\index.htm”. This can be any URL for a web, such as http://web server/folder/file or file://file system/folder/file for disk-based webs.

ForceOverwrite Optional Boolean. The default value is True.

Example

This example saves an existing file to another web under a new name. (It isn't necessary to change the name of the file.) The program first activates the container web, and then it opens the file so that a page window is established for the file. The page window is assigned to a variable and saved to a different web under a new name.

Note You must have a file named Zinfandel.htm in the C:\My Webs folder, or change the name of the file in the program to match an existing file in your web.

Private Sub SaveAsNewFile()
    Dim myFile As WebFile
    Dim myPageWindow As PageWindowEx

    Webs("C:\My Webs").Activate
    Set myFile = ActiveWeb.RootFolder.Files("Zinfandel.htm")
    myFile.Open
    Set myPageWindow = ActivePageWindow
    myPageWindow.SaveAs ("C:\My Webs\Rogue Cellars\Zinfandel Sale.htm")
    myPageWindow.Close
End Sub


SaveReport Method

Saves a specified report to an HTML file on the user's computer.

expression.SaveReport(reportviewModeEx, DestinationUrl, Title, ForceOverwrite)

expression Required. An expression that returns one of the objects in the Applies To list.

reportviewModeEx Required. An FpWebViewModeEx constant that represents the type of report you want to save.

FpWebViewModeEx can be one of these FpWebViewModeEx constants.
fpWebViewExAllFiles
fpWebViewExAssignedTo
fpWebViewExBrokenLinks
fpWebViewExBrowserTypes
fpWebViewExCategories
fpWebViewExCheckoutStatus
fpWebViewExComponentErrors
fpWebViewExDailyPageHits
fpWebViewExDailySummary
fpWebViewExFolders
fpWebViewExLinks
fpWebViewExMonthlyPageHits
fpWebViewExMonthlySummary
fpWebViewExNavigation
fpWebViewExOlderFiles
fpWebViewExOsTypes
fpWebViewExPage
fpWebViewExPublishStatus
fpWebViewExRecentlyAddedFiles
fpWebViewExRecentlyChangedFiles
fpWebViewExReferringDomains
fpWebViewExReferringURLs
fpWebViewExReviewStatus
fpWebViewExSearchStrings
fpWebViewExSiteSummary
fpWebViewExSlowPages
fpWebViewExTodo
fpWebViewExUnlinkedFiles
fpWebViewExUsageSummary
fpWebViewExVisitingUsers
fpWebViewExWeeklyPageHits
fpWebViewExWeeklySummary

DestinationUrl Required. A String that represents the destination file name of the report.

Title Required. A String that represents the title of the new report.

ForceOverwrite Optional. A Boolean that indicates if any previously-created report with the same file name will be overwritten by the new report. If True, the report will be overwritten. If False, the report will not be overwritten. The default value is True.

Example

The following example saves a report of all files in the current web to a file named Report1.htm on the local user's computer. The report will overwrite any existing report in the \Reports directory with the name "Report1.htm".

Sub ReportSave()
'Saves a specified report to a specified location.

    Dim objApp As FrontPage.Application
    Dim objWebwdw As WebWindowEx

    Set objApp = FrontPage.Application
    Set objWebwdw = objApp.ActiveWebWindow
    'Save the report
    objWebwdw.SaveReport reportviewModeEx:=fpWebViewExAllFiles, _
                         Title:="Current Project Progress", _
                         DestinationURL:="C:\NewProject\Reports\Report1.htm", _
                         ForceOverwrite:=True

End Sub


toString Method

Returns a String associated with an aspect of the object.

expression.toString

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

The toString method is largely unsupported. If executed from an unsupported object it will always return the String "[object]".

Example

The following example displays the string associated with the active document's location property.

Sub ReadString()

    Dim FPApp As FrontPage.Application
    Dim objDoc As Object

    Set FPApp = FrontPage.Application
    Set objDoc = FPApp.ActiveDocument.location

    If objDoc Is Nothing Then
        MsgBox "There is no current active document."
    Else
        MsgBox "The string associated with this object is: " & objDoc.toString
    End If

End Sub


UndoCheckout Method

Returns the specified WebFile object to its prior state in the source control project.

Note You must have a source control project in place before using this method. For information about source control projects, refer to Managing Source Control Projects.

expression.UndoCheckout

expression An expression that returns a WebFile object.

Example

This example checks a file in to its prior state (its state before checkout). The file must be part of a source control project.

Note To run this procedure, you must have a source control project in place with one web window open and a page called Zinfandel.htm contained in the web. Or, substitute a web and file of your choosing.

Private Sub UndoCheckout()
    Dim myWeb As WebEx

    Set myWeb = ("C:/My Webs/Rogue Cellars")
    myWeb.RootFolder.Files("Zinfandel.htm").UndoCheckout
End Sub


VerifyAllLinks Method

Verifies all hyperlinks in the hierarchy of the current web. The VerifyAllLinks method is used by the Broken Hyperlinks report to display any pages with broken hyperlinks.

expression.VerifyAllLinks

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example creates a reference to the active web window and calls the VerifyAllLinks method to check if any broken links exist in the current project. Then, the active web window switches to the Broken Hyperlinks reports view.

Sub VerifyLinks()
'Verifies broken links in the current view

    Dim objApp As FrontPage.Application
    Dim objWebwdw As WebWindowEx

    Set objApp = FrontPage.Application
    Set objWebwdw = objApp.ActiveWebWindow
    'Verify all links in the current web.
    objWebwdw.VerifyAllLinks

End Sub


ActiveDocument Property

Returns the active document as an DispFPHTMLDocument object.

expression.ActiveDocument

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This object provides access to the Microsoft FrontPage Page object model elements that are compatible with Microsoft Internet Explorer 4.0 and later. This object model provides programmatic capability for the HTML and DHTML programming elements of Internet Explorer.

Example

The following statement returns the ActiveDocument object for the Application object.

myDoc = Application.ActiveDocument

The following statement returns the ActiveDocument object for the PageWindowEx object.

myDoc = Application.WebWindows(0).PageWindows(0).ActiveDocument


activeElement Property

Returns an IHTMLElement object that represents the active element in the current document.

expression.activeElement

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the active element of the current document and displays the element's associated class name. If the className property is empty, a message is displayed to the user instead.

Sub ReturnActiveElement()
'Returns the active element of the current document
'and displays the element's class name.

    Dim objApp As FrontPage.Application
    Dim objElement As IHTMLElement

    Set objApp = FrontPage.Application
    Set objElement = objApp.ActiveDocument.activeElement

    'If the classname is not empty then
    If objElement.className <> "" Then
        'Display class name to user
        MsgBox "The current element is a " & _
               objElement.className & "."
    Else
       'Otherwise display message
       MsgBox "The current element has no associated class name."
    End If

End Sub


ActiveFrameWindow Property

Returns an FPHTMLWindow2 object of the selected frame in the page window.

expression.ActiveFrameWindow

expression Required. An expression that returns a PageWindowEx object.

Note Accessing the ActiveFrameWindow property is the same as accessing the parent window through the active page window as follows:

ActivePageWindow.Document.parentWindow

Example

This example retrieves the ActiveFrameWindow object.

Private Sub GetActiveFrame()
    Dim myPageWindow As PageWindowEx
    Dim myFrame As FPHTMLWindow2

    Set myPageWindow = _
            ActiveWeb.ActiveWebWindow.ActivePageWindow
    Set myFrame = myPageWindow.ActiveFrameWindow
End Sub


ActivePageWindow Property

Returns the PageWindowEx object of the Application or web window.

expression.ActivePageWindow

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example returns the PageWindowEx object for the Application object.

Private Sub GetActivePageWindow()
    Dim myPageWindow As PageWindowEx

    Set myPageWindow = ActivePageWindow
End Sub

The following example returns the PageWindowEx object from the WebWindowEx object.

Private Sub GetActivePageWindow()
    Dim myPage As PageWindowEx

    Set myPage = ActiveWebWindow.ActivePageWindow
End Sub


ActiveWeb Property

Returns a WebEx object of the parent Application object.

Remarks

The Microsoft FrontPage Application object model provides access to the Web object model through the ActiveWeb object. For more information about the FrontPage object models, see Exploring the Object Model in FrontPage.

Example

This example uses the ActiveWeb property to locate the web page index.htm and changes the background color of the web page.

Note To run this example, create a form with one command button called cmdActiveWebColorChange and paste the following code in the code window. You must have a web page called index.htm for this procedure to change the background color.

Private Sub cmdActiveWebBKGRDColorChange_Click()
    Dim myPageWin As PageWindowEx

    Set myPageWin = Application.ActiveWeb.LocatePage("index.htm")

    myPageWin.Document.bgColor = "PapayaWhip"

End Sub

Note Microsoft Visual Basic for Applications provides color constants with a "vb" prefix, such as vbCyan. FrontPage builds Web pages in HTML, which uses different color constants than Visual Basic. If you use the color constants provided with Visual Basic in your existing programs, you may need to change these to the equivalent hexadecimal color values when you port your programs to a FrontPage-based web, or when you use colors across Office applications that include a FrontPage-based web.


ActiveWebWindow Property

Returns a WebWindowEx object for the Application or WebEx objects.

Example

This example prints the value of the ActiveDocument.nameProp property for the WebEx object.

Note To run this example, create a form with a command button called cmdActiveWebWindowDisplay and a label called lblWebWindowDisplay. Paste the following code in the code window. You must have a FrontPage-based web page open for this procedure to return a document name.

Private Sub cmdActiveWebWindowDisplay_Click()
    On Error Resume Next
    Dim myCurrentWebWindow As WebWindowEx

    Set myCurrentWebWindow = Application.ActiveWebWindow

    With myCurrentWebWindow
        lblWebWindowDisplay.Caption = .ActiveDocument.nameProp
    End With
End Sub


alinkColor Property

Returns or sets a Variant that represents the font color used to display the active link. Read/write.

expression.alinkColor

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example sets the active link color to black. The active link will now appear black in the document.

Sub SetAlink()
'Sets the color of the active link

    Dim objDoc As DispFPHTMLDocument

    Set objDoc = FrontPage.ActiveDocument
    'Set color of active link to black
    objDoc.alinkColor = "000000"

End Sub


all Property

Returns an IHTMLElementCollection collection that represents the collection of all elements in the document.

expression.all

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

The collection includes one element object for each valid HTML tag. If a valid tag has a matching end tag, both tags are represented by the same element object.

The collection always includes the HTML, HEAD, TITLE and BODY objects regardless of whether the tags are present in the document.

If the document contains invalid or unknown tags, the collection includes one element object for each tag. Therefore, invalid or unknown end or beginning tags are represented by their own element objects in the collection. The order of the element objects is the HTML source order. Although the collection indicates the order of tags, it does not indicate hierarchy.

Example

The following example displays the tag name of each element in the current document. The Length property is used to return the index position of the last element in the collection. Because the collection is zero-based (the first element in the collection has the index value zero (0)), use Length - 1 to return the number of elements in the collection.

Sub ElementCollection()
'Returns the collection of all elements in the active document

    Dim objAll As IHTMLElementCollection

    Set objAll = FrontPage.ActiveDocument.all

    For i = 0 To objAll.Length - 1
        'Display names of all element items in collection
        MsgBox "Element tag name: " & objAll.Item(i).tagName
    Next i

End Sub


AllFiles Property

Returns a WebFiles collection that represents all files in the current web.

expression.AllFiles

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The WebFiles collection returns all files in the collection regardless of their position in the web hierarchy.

Example

The following example searches through the WebFiles collection for a page with the title Main Page. If the page is found, it is opened in Microsoft FrontPage.

Sub FindFileTitle()
'Returns a collection of all files in the current web.

    Dim objApp As FrontPage.Application
    Dim objWebFile As WebFile
    Dim objWebFiles As WebFiles
    Set objApp = FrontPage.Application
    'Create a reference to the WebFiles collection
    Set objWebFiles = objApp.ActiveWeb.AllFiles

    'Check each file in the collection for the title Main Page
    For Each objWebFile In objWebFiles
       'If the title is found open the page in the editor.
       If objWebFile.Title = "Main Page" Then
          'Open page
          objWebFile.Open
       End If
    'If not found, check next file.
    Next objWebFile

End Sub


AllFolders Property

Returns a WebFolders collection that represents all folders in the current web.

expression.AllFolders

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The WebFolders collection returns all folders in the collection regardless of their position in the web hierarchy.

Example

The following example searches through the WebFolders collection for a folder named "Folder1". If the folder is found, the example searches for a file with the title Main Page. If the title is found, the file is opened in Microsoft FrontPage.

Sub WebFoldersFind()
'Returns a collection of all files in the current web.

    Dim objApp As FrontPage.Application
    Dim objWebFolder As WebFolder
    Dim objWebFolders As WebFolders
    Set objApp = FrontPage.Application
    'Create a reference to the WebFolders collection.
    Set objWebFolders = objApp.ActiveWeb.AllFolders

    'Check each folder in the collection for the name "Folder1"
    For Each objWebFolder In objWebFolders
       'If the name is found then
       If objWebFolder.Name = "Folder1" Then
          'If found then search through folder
          For i = 1 To objWebFolder.Files.Count
              'Search for a file with the title Main Page
              If objWebFolder.Files.Item(i).Title = "Main Page" Then
                  'Open file.
                  objWebFolder.Files.Item(i).Open
              End If
          Next i
       End If
    'If not found check next file.
    Next objWebFolder

End Sub


AllNavigationNodes Property

Returns a NavigationNodes collection object that represents a collection of all navigation nodes in the current web. Navigation nodes are used to display a graphic representation of the current web in Microsoft FrontPage Navigation view.

expression.AllNavigationNodes

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example returns a reference to the NavigationNodes collection and displays the file name of the first object in the collection and the title of the web in which it exists.

Sub AllNavigationNodes()
'Return a collection of all navigation nodes used in the current web

    Dim objApp As FrontPage.Application
    Dim objNavNode As NavigationNode
    Dim objNavNodes As NavigationNodes

    Set objApp = FrontPage.Application
    'Create a reference to the NavigationNodes collection.
    Set objNavNodes = objApp.ActiveWeb.AllNavigationNodes
    'Return a reference to the first node in the collection.
    Set objNavNode = objNavNodes.Item(0)

    'Display the file name and the web of the first
    'navigation node in the collection
    MsgBox "The URL of this file is " & objNavNode.Url & _
            vbCr & ". It is found in the web " _
            & objNavNode.Web.Title & "."

End Sub


AllowMultipleResponses Property

Returns or sets a Boolean that determines if users can respond more than once to a given survey. If False, a user can only respond once to a survey. Read/write.

expression.AllowMultipleResponses

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example sets the AllowMultipleResponses property of all Survey objects in the active web to False. Users can only respond once to a given survey.

Sub ChangeResponses()
'Sets number of responses to one per user

    Dim objApp As FrontPage.Application
    Dim objList As Object
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists

    'Cycle through each list and check for list type
    For Each objList In objLists
        'If it's a Survey then change responses to single
        If objList.Type = fpListTypeSurvey Then
            objList.AllowMultipleResponses = False
        End If
    Next

End Sub


AllowsLongFilenames Property

True if the operating system on the machine where the web resides accepts long file names. Read-only Boolean.

Example

This example checks the value of the AllowsLongFilenames property of the active WebEx object. This example assumes that ConvertLongFilenames is a procedure that is available to this code sample.

If ActiveWeb.AllowsLongFilenames = True Then
    Exit Sub
Else
    Call ConvertLongFilenames()
End If


anchors Property

Returns an IHTMLElementCollection collection that represents all anchor elements in the current document that have a specified name and/or ID attribute. Anchor elements correspond to an <A> tag.

expression.anchors

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

If the anchor attribute is not set, it does not appear in the collection.

Example

The following example returns the collection of all anchors in the current document and displays the name associated with each element.

Sub AnchorsCollection()
'Returns the collection of all anchor elements in the active document.

    Dim objAll As IHTMLElementCollection

    'Reference the anchors collection
    Set objAll = FrontPage.ActiveDocument.anchors

    For i = 0 To objAll.Length - 1
        'Display names of all set anchor items in collection
        MsgBox "Element name: " & objAll.Item(i).Name
    Next i

End Sub


AnswerWizard Property

Some of the content in this topic may not be applicable to some languages.

Returns the read-only Answer Wizard object.

Example

This example adds an Answer Wizard file, and retrieves the Creator and Count properties.

Note The Creator property for FrontPage is different from the Creator property used by other Microsoft Office objects, such as the AnswerWizard object. The Creator property for FrontPage uses a string format, while Office objects use a 32-bit integer to identify the application that created the file. In this example, you'll note that the Creator property returns a 32-bit integer rather than the FrontPage string format because the AnswerWizard object is an Office ImsoDispObj object. For more information, use the Object Browser for all libraries or Microsoft Visual Basic Help to view more detailed information about the Creator property for Microsoft Office objects.

Private Sub GetAnswerWizardInfo()
    Dim myAW As AnswerWizard
    Dim myAWFiles As AnswerWizardFiles
    Dim myAWCount As Integer
    Dim myAWCreator As String

    Set myAW = ActiveWeb.Application.AnswerWizard
    Set myAW = myAW.Files

    With myAWFiles
            myAWCreator = .Creator
            .Add("myAWFile")
            myAWCount = .Count
    End With
End Sub


applets Property

Returns an IHTMLElementCollection object collection that represents a collection of all applets in the current document.

expression.applets

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example returns a reference to the applets collection and displays the names of all applets in the current document.

Sub AppletsCollection()
'Returns the collection of all applets in the active document.

    Dim objApp As FrontPage.Application
    Dim objAll As IHTMLElementCollection

    Set objApp = FrontPage.Application
    'Reference the applets collection.
    Set objAll = FrontPage.ActiveDocument.applets

    For i = 0 To objAll.Length - 1
        'Display names of all applets in collection.
        MsgBox "Element tag name: " & objAll.Item(i).Name
    Next i

End Sub


Application Property

Returns the Application object.

expression.Application

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Used without a qualifier, this property provides direct access to the Microsoft FrontPage Application object. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object—you can use this property with an Automation object to return that object's application.

Example

The application name can be directly accessed from the objects and collections in the FrontPage object model. This statement shows the application accessed from the Files collection.

Set currApp = ActiveWeb.RootFolder.Files.Application


Assistant Property

Some of the content in this topic may not be applicable to some languages.

Returns an Assistant object that represents the Microsoft Office Assistant. Read-only.

expression.Assistant

expression Required. An expression that returns an Application object.

Example

The following example returns a reference to the Microsoft Office Assistant and modifies its properties. The subroutine displays the Assistant on the screen, turns animation sounds on, and sets the MoveWhenInTheWay property to True. The Assistant will now move to another location on the screen if it is in the user's way.

Sub fpAsst()
'Creates a reference to the Office Assistant and modifies its properties

    Dim objApp As FrontPage.Application
    Dim objAsst As Assistant
    Set objApp = FrontPage.Application
    'Return a reference to the Office Assistant
    Set objAsst = objApp.Assistant
    With objAsst
       'Make assistant visible
       .Visible = True
       'Allow sounds during animations
       .Sounds = True
       'Move the Assistant out of the way when needed
       .MoveWhenInTheWay = True
    End With

End Sub


bgColor Property

Returns or sets a Variant that represents the background color of the current page. Read/write.

expression.bgColor

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example creates a reference to the current document in the active page window, modifies its background color and displays the title of the document. The background of the page will now appear black.

Sub DocumentbgColor()
'Returns the active HTML document and changes color

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objPgeWdw As PageWindowEx
    Set objApp = FrontPage.Application
    'Create reference to active page window.
    Set objPgeWdw = objApp.ActivePageWindow
    'Create reference to open document.
    Set objDoc = objPgeWdw.Document

    With objDoc
        'Display title and change background color
        MsgBox "The background color has changed for: " & .Title
        .bgColor = "000000"
    End With
End Sub


body Property

Returns an IHTMLElement that corresponds to the enclosed body tags of the HTML page. The HTML body element defines certain settings of the page such as text color and background color.

expression.body

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example creates a reference to the body element and modifies its background and text color. The document background will now appear white and the foreground text will appear blue.

Sub DocumentBody()
'Returns the active HTML document and modifies the body

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objPgeWdw As PageWindowEx
    Dim objBody As IHTMLBodyElement

    Set objApp = FrontPage.Application
    'Create reference to active page window
    Set objPgeWdw = objApp.ActivePageWindow
    'Create reference to open document
    Set objDoc = objPgeWdw.Document
    Set objBody = objDoc.body

    'Set background color to white and text color to blue
    With objBody
        .bgColor = "FFFFFF"
        .Text = "3333FF"
    End With

End Sub


Build Property

Returns the build number for the specified object. Read-only String.

Remarks

If the Application object is specified, the Build property returns the build number of the application. When the System object is specified, this property returns the build number of the operating system. For example, the format used on the About dialog box for an application might look like this: “Version: 4.0.0.xxxx,” where xxxx is the build number of the application. When the Build property for the System object is accessed, it returns the current build of the operating system as you might see used on the Properties page of the System dialog box.

Example

The following statement returns the build number of the application.

myAppBuild = Application.Build

You can access the system build as shown in the following statement.

mySysbuild = System.Build


Caption Property

Returns the text of the title bar for the specified object. Read-only String.

expression.Caption

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The Caption property returns different values depending on the specified object. For example, the Caption property for the PageWindowEx object returns the file URL of the open page, while the Caption property for the WebWindowEx object returns the text of the title bar for the Microsoft FrontPage application window.

Example

This statement returns the caption of the active page.

myCaption = ActivePageWindow.Caption

This example demonstrates accessing both the active WebWindowEx and PageWindowEx objects using the With and For statements.

Private Sub GetPageWindowCaption()
    Dim myWebWindow As WebWindowEx
    Dim myPageWindows As PageWindows
    Dim myPageWindowCaptions As String
    Dim myWebWindowCaption As String

    Set myWebWindow = Application.ActiveWebWindow
    Set myPageWindows = myWebWindow.PageWindows

    With myWebWindow
        myWebWindowCaption = .Caption
    End With

    For Each myPageWindow In myPageWindows
        myPageWindowCaptions = myPageWindowCaptions & myPageWindow.Caption
    Next
End Sub


CheckedoutBy Property

Returns the logon name of the person to whom the specified WebFile object is checked out. Read-only String.

Note You must have a source control project in place before using this method.

Example

This example retrieves the logon alias of the person who checked out the file.

Note You must have a source control project to run this example.

Private Sub GetCheckedOutBy()
    Dim myCheckedOutAlias As String

    myCheckedOutAlias = _
        ActiveWeb.RootFolder.Files(0).CheckedOutBy
End Sub


Children Property

Returns the collection of child navigation nodes for a navigation node. Read-only NavigationNodes object.

Example

This example returns the number of child nodes that exist directly below the home page navigation node.

Private Sub GetChildrenCount()
    Dim myCount As Integer

    myCount = ActiveWeb.HomeNavigationNode.Children.Count
End Sub


Choices Property

Returns or sets a String that represents an array of all choices in the current choice field. Read/write.

expression.Choices

expression Required. An expression that returns a ListFieldChoice object.

Example

The following example displays the text for all choices in the field "NewChoiceField". If the field contains no choices, a message is displayed to the user. The field NewChoiceField is an object of type ListFieldChoice.

Sub ViewChoices()
'Displays the choices in the current field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim objFldChoice As ListFieldChoice
    Dim VarChoices As Variant
    Dim strChoice As String
    Dim blnFound As Boolean

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    'Reference choice field
    Set objFldChoice = objLstFlds.Item("NewChoiceField")
    blnFound = False
    For Each VarChoice In objFldChoice.Choices
        If strChoice = "" Then
            'if first value in string
            strChoice = VarChoice & vbCr
            'The list contains at least one choice
            blnFound = True
        Else
            'add value to string
            strChoice = strChoice & VarChoice & vbCr
        End If
    Next VarChoice
    If blnFound = True Then
        'Display choices
        MsgBox "The current list contains the following choices: " & _
        vbCr & strChoice
    Else
        'Display message to user
        MsgBox "The current field contains no choices."
    End If

End Sub


COMAddIns Property

Returns the COMAddIns object.

Remarks

All of the FrontPage add-ins that are registered in the Windows Registry are located under the following key:

HKEY_CURRENT_USER\Software\Microsoft\Office\version\FrontPage\AddIns

Add-ins designed for administrators are registered under:

HKey_Local_Machine\Software\Microsoft\Office\version\FrontPage\Addins

Example

This example returns the number of add-ins available to Microsoft FrontPage.

Private Sub GetCOMAddIns()
    Dim myWeb As WebEx
    Dim myAddinCount As Integer

    Set myWeb = ActiveWeb
    myAddinCount = Application.COMAddIns.Count

End Sub


CommandBars Property

Returns a CommandBars object that represents the menu and toolbars displayed by Microsoft FrontPage.

Remarks

You can't access FrontPage-specific popup context menus using command bars. For example, you can't access the context menu that appears when you right-click a page in Pages view. However, you can create your own popup context menus using the ShowPopup method for the CommandBar object.

Example

The following three procedures set up a new menu item on a toolbar.

Procedure 1:

Sub AddMenuItem()
    Dim newMenu As CommandBarControl
    Dim toolsMenu As CommandBar
    Set toolsMenu = Application.CommandBars("Tools")

    Set newMenu = _
            toolsMenu.Controls.Add(msoControlButton, , , , True)

    newMenu.Caption = "New &Menu Item"
End Sub

This next procedure connects the click event to the custom button and must be added to a class or form module. The module shown is a form module. This procedure adds a new item to the Tools menu and connects the events of the custom button by assigning the variable e_NewMenu (used in the WithEvents statement) to the custom button variable newMenu.

Procedure 2:

Private Sub AddButton_Click()
    Dim newMenu As CommandBarControl
    Dim WithEvents e_NewMenu As CommandBarButton

    Sub AddMenuItemWithEventHook()
        Dim toolsMenu As CommandBar
        Set toolsMenu = Application.CommandBars("Tools")

        Set newMenu = _
                toolsMenu.Controls.Add(msoControlButton, , , , True)

        Set e_NewMenu = newMenu
        newMenu.Caption = "New &Menu Item"
    End Sub

Private Sub e_NewMenu_Click(ByVal Ctrl As _
        Office.CommandBarButton, CancelDefault As Boolean)
    MsgBox "Menu Item Clicked"
    Ctrl.Caption = "Clicked"
End Sub

To execute FrontPage custom menu items using CommandBars collection, index the menu item and call the execute method for that item. The following example inserts a Microsoft Office spreadsheet control at the insertion point.

Procedure 3:

Sub ExecuteMenu()
    Dim I As String
    Dim C As String
    Dim O As String

    I = "Insert"
    C = "C&omponent"
    O = "Office Sp&readsheet"

    CommandBars(I).Controls(C).Controls(O).Execute
End Sub

The following example returns the status of various properties of the command bars in the active web.

Private Sub GetCommandBars()
    Dim myWeb As WebEx
    Dim myCB As Object
    Dim myCBCount As Integer
    Dim myDisplayFonts As Boolean
    Dim myDisplayKeysInToolTips As Boolean
    Dim myLargeButtons As Boolean
    Dim myMenuAnimationStyle As String

    Set myWeb = ActiveWeb
    Set myCB = Application.CommandBars

    With myCB
            myCBCount = .Count
            myDisplayFonts = .DisplayFonts
            myDisplayKeysInToolTips = .DisplayKeysInTooltips
            myLargeButtons = .LargeButtons
            myMenuAnimationStyle = .MenuAnimationStyle
    End With
End Sub

The following example is a tool that iterates through the command bars and returns several properties from each menu.

Note To run this example, create a form that has a text box called txtComBar and a command button called cmdComBar, and copy the following code to the code window.

Private Sub cmdComBar_Click()
    Dim myWeb As WebEx
    Dim myComBars As Object
    Dim myComBar As Object
    Dim myText As String
    Dim myName As String
    Dim myAdaptMenu As String
    Dim myEnabledMenu As String
    Dim myMenuHeight As String
    Dim myMenuWidth As String

    Set myWeb = ActiveWeb
    Set myComBars = Application.CommandBars
    myName = "Name: "
    myAdaptMenu = "Menu Adaptive? "
    myEnabledMenu = "Menu Enabled? "
    myMenuHeight = "Menu Height: "
    myMenuWidth = "Menu Width: "
    txtComBar.Locked = True
    txtComBar.maxLength = 10000
    txtComBar.MultiLine = True
    txtComBar.ScrollBars = fmScrollBarsVertical

    With myComBars
        For Each myComBar In myComBars
            With myComBar
                myText = myText & myName & .Name & vbCrLf
                myText = myText & myAdaptMenu & .AdaptiveMenu & vbCrLf
                myText = myText & myEnabledMenu & .Enabled & vbCrLf
                myText = myText & myMenuHeight & .Height & vbCrLf
                myText = myText & myMenuWidth & .Width & vbCrLf
                txtComBar.Text = myText
            End With
        Next
        txtComBar.SetFocus
        txtComBar.CurLine = 0
    End With
End Sub


ConnectionSpeed Property

Returns or sets an FpConnectionSpeed value that indicates the users' Internet connection type. Read/write.

FpConnectionSpeed can be one of these FpConnectionSpeed constants.
fpConnect144 14400 baud-rate modem
fpConnect288 28800 baud-rate modem
fpConnect56K 56600 baud-rate modem
fpConnectISDN ISDN connection
fpConnectT1 T1 connection
fpConnectT3 T3 connection

expression.ConnectionSpeed

expression Required. An expression that returns an Application object.

Remarks

The ConnectionSpeed property is used in conjunction with the SlowPage property to determine the simulated download time of a Web page. The default value is fpConnect144.

Example

The following example sets the ConnectionSpeed property to fpConnect56K, simulating a 56K modem. The amount of time a file takes to download and the criteria used to determine a "slow" page in the Reports view will be based on this value.

Sub SpeedOfConnection()
'Modifies the ConnectionSpeed property

    Dim objApp As FrontPage.Application
    Set objApp = FrontPage.Application

    With objApp
       'Set the connection type to 56K modem
       .ConnectionSpeed = fpConnect56K
    End With

End Sub


Count Property

Returns the number of items in the specified collection. Read-only Variant.

Remarks

Some collections are 0-based and some are 1-based. The Count property for collections begins with one even though you access the first item in a collection with a zero.

Example

The following example returns the number of themes and folders in the active web.

Private Sub GetWebCount()
    Dim myWeb As WebEx
    Dim myCount As Integer

    Set myWeb = ActiveWeb

    With myWeb
            myThemeCount = .Themes.Count
            myFolderCount = .RootFolder.Folders.Count
    End With
End Sub


Creator Property

Returns a string that indicates the application in which this object was created. If the object was created in Microsoft FrontPage, this property returns the string "FrontPage.Editor.Document". Read-only String.

Note The Creator property for FrontPage is different from the Creator property used by other Microsoft Office objects. The Creator property for FrontPage uses a string format, while Office objects use a 32-bit integer to identify the application that created the file.

Example

This example checks if the creator of a file is FrontPage.

Private Sub GetCreator()
    Dim myCreator As String

    myCreator = ActiveWeb.RootFolder.Files(0).Creator

    If myCreator <> "FrontPage.Editor.Document" Then
        MsgBox "This file was not created by FrontPage."
    End If
End Sub


Currency Property

Returns or sets an FpCurrencyFieldFormat enumerated constant that determines the type of currency to be used in the currency field. Read/write.

FpCurrencyFieldFormat can be one of these FpCurrencyFieldFormat constants.
fpCurrencyFieldArgentina
fpCurrencyFieldAustralia
fpCurrencyFieldAustria
fpCurrencyFieldBelgiumBF
fpCurrencyFieldBelgiumFB
fpCurrencyFieldBolivia
fpCurrencyFieldBrazil
fpCurrencyFieldCanada
fpCurrencyFieldCanadaF
fpCurrencyFieldChile
fpCurrencyFieldColombia
fpCurrencyFieldCostaRica
fpCurrencyFieldCzech
fpCurrencyFieldDenmark
fpCurrencyFieldDominicanRepublic
fpCurrencyFieldEcuador
fpCurrencyFieldElSalvador
fpCurrencyFieldEuro
fpCurrencyFieldEuroPostfix
fpCurrencyFieldFinland
fpCurrencyFieldFrance
fpCurrencyFieldGermany
fpCurrencyFieldGreece
fpCurrencyFieldGuatemala
fpCurrencyFieldHonduras
fpCurrencyFieldHongKong
fpCurrencyFieldHungary
fpCurrencyFieldIreland
fpCurrencyFieldItaly
fpCurrencyFieldJapan
fpCurrencyFieldKorea
fpCurrencyFieldMexico
fpCurrencyFieldNetherlands
fpCurrencyFieldNewZealand
fpCurrencyFieldNicaragua
fpCurrencyFieldNorway
fpCurrencyFieldPanama
fpCurrencyFieldParaguay
fpCurrencyFieldPeru
fpCurrencyFieldPoland
fpCurrencyFieldPortugal
fpCurrencyFieldPRChina
fpCurrencyFieldRussia
fpCurrencyFieldSingapore
fpCurrencyFieldSlovakia
fpCurrencyFieldSlovenia
fpCurrencyFieldSouthAfrica
fpCurrencyFieldSpain
fpCurrencyFieldSweden
fpCurrencyFieldSwitzerland
fpCurrencyFieldTaiwan
fpCurrencyFieldTurkey
fpCurrencyFieldUnitedKingdom
fpCurrencyFieldUnitedStates
fpCurrencyFieldUruguay
fpCurrencyFieldVenezuela

expression.Currency

expression Required. An expression that returns a ListFieldCurrency object.

Remarks

The default value for this field is determined by the user's personal settings.

Example

The following example creates a new field of type ListFieldCurrency and changes the default currency setting to display Canadian.

Sub CreateCurrencyField()
'Add new Currency field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim objFldChoice As ListFieldCurrency
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewCurrencyField"
    'Add new Field of type fpFieldCurrency to list
    objLstFlds.Add Name:=strName, Description:="New Choice value Field", _
                   Fieldtype:=fpFieldCurrency, Required:=True
    Set objFldChoice = objLstFlds.Item("NewCurrencyField")
    'Change currency type to Canadian
    objFldChoice.Currency = fpCurrencyFieldCanada
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub


currentStyleState Property

Returns an IFPStyleState object that represents the style state of the current document.

expression.currentStyleState

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the style state of the current document. The display type of the current style state is displayed to the user.

Sub StyleState()
'References the style state of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objStyleState As IFPStyleState

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Create a reference to the IFPStyleState object.
    Set objStyleState = objDoc.currentStyleState
    MsgBox "The display type of the current style state is " & _
            objStyleState.Display

End Sub


defaultCharset Property

Returns or sets a String that represents the default character set of the current document. Read/write.

expression.defaultCharset

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the default character set of the current document.

Sub CharSet()
'Displays the default character set of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display the name of the default character set
    MsgBox "The default character set for the current document is " _
            & objDoc.defaultCharset & "."

End Sub


DefaultValue Property

Returns or sets a Variant that defines the default value of the field. Read/write.

expression.DefaultValue

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The default value of all pre-populated fields is Empty.

Example

The following example displays the names of all fields in the list and their associated default values. If the active web does not contain any lists, a message is displayed to the user.

Sub FieldDefaultValue()
'Display the default value of the field

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application

    If Not ActiveWeb.Lists Is Nothing Then
        'Display fields in first list of collection
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            If strType = "" Then
                'if first value in string
                strType = objField.Name & "  -  " & _
                objField.DefaultValue & vbCr
            Else
                'add value to string
                strType = strType & objField.Name & "  -  " & _
                objField.DefaultValue & vbCr
            End If
        Next objField
        MsgBox "The names of the fields in this list and their default" & _
                     " values are: " & vbCr & strType
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub


DefaultViewPage Property

Returns or sets a String that defines the relative URL to the page that is viewed when the list is opened. This property defines the default view page field on the Supporting Files tab of the Properties dialog box. Read/write.

expression.DefaultViewPage

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The default start page is AllItems.htm.

Example

The following example lists the names of all lists in the document and their corresponding default view page URLs. The subroutine creates a single string containing all list names and default view pages and displays the formatted message to the user.

Sub ViewDefaultPage()
'Lets the user view the default view
'page for all lists in the web.

    Dim lstWebList As List
    Dim strURL As String

    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists
        For Each lstWebList In ActiveWeb.Lists
            'add default view pages names to string
            If strURL = "" Then
                strURL = lstWebList.Name & "  -  " & _
                lstWebList.DefaultViewPage & vbCr
            Else
                strURL = strURL & lstWebList.Name & "  -  " & _
                lstWebList.DefaultViewPage & vbCr
            End If
        Next
        'Display default view pages of all lists
        MsgBox "The default view pages of all lists in the current web are:" _
               & vbCr & vbCr & strURL
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub


Description Property

Returns or sets a String that represents the description for the current list. The description appears below the title of the list on the default view page. Read/write.

expression.Description

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example prompts the user to enter a description for the first list in the collection. The Description property is changed based on the user's input.

Sub SetDescription()
'Set the list description

    Dim objApp As FrontPage.Application
    Dim objWeb As WebEx
    Dim lstWebList As List
    Dim StrDesc As String

    Set objApp = FrontPage.Application
    Set objWeb = objApp.ActiveWeb
    'Reference first list in collection
    Set lstWebList = objWeb.Lists.Item(0)
    'Get new description from user
    StrDesc = InputBox("Enter a new description for the list " & _
              lstWebList.Name & ".")
    'Set description property
    lstWebList.Description = StrDesc

End Sub


DesignSecurity Property

Returns or sets an FpListDesignSecurity constant that defines the security permissions of the List.

FpListDesignSecurity can be one of these FpListDesignSecurity constants.
fpListDesignSecurityCreator Only the creator of the list has permission to modify it.
fpListDesignSecurityEveryone All users have permission to modify the list.

expression.DesignSecurity

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example changes the security mode of each BasicList object in the current web. The subroutine changes the DesignSecurity property to fpListDesignSecurityEvery if it isn't already set. Once the property is set, all users can edit the design settings of BasicList objects in the current web.

Note Use the ApplyChanges method to save any changes made to the list.

Sub SetSecurityType()
'Changes security type of all BasicLists.

    Dim objApp As FrontPage.Application
    Dim objList As List
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists

    'Cycle through each list and check for list type
    For Each objList In objLists
        'If it's a BasicList than change permissions
        If objList.Type = fpListTypeBasicList Then
            If objList.DesignSecurity <> _
               fpListDesignSecurityEveryone Then
                objList.DesignSecurity = _
                fpListDesignSecurityEveryone
            End If
            objList.ApplyChanges
        End If
    Next

End Sub


DisplayForm Property

Returns or sets a String that represents the relative URL of the form associated with the list. The web form contains the user interface associated with the list. Read/write.

expression.DisplayForm

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example displays the names of all lists in the active web and the relative URL's of their associated web forms.

Sub ViewFormURL()
'Displays the URL of the form
'associated with the list

    Dim lstWebList As List
    Dim strURL As String

    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists and add URLs to string
        For Each lstWebList In ActiveWeb.Lists
            If strURL = "" Then
                strURL = lstWebList.Name & "  -  " & _
                lstWebList.DisplayForm & vbCr
            Else
                strURL = strURL & lstWebList.Name & "  -  " & _
                lstWebList.DisplayForm & vbCr
            End If
        Next
        'Display URLs of all forms in web
        MsgBox "The relative URLs of the forms are:" _
               & vbCr & vbCr & strURL
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub


DisplayFormat Property

DisplayFormat property as it applies to the ListFieldChoice object.

Returns or sets an FpChoiceFieldFormat enumerated constant that represents the type of user interface control used by the field. Read/write.

FpChoiceFieldFormat can be one of these FpChoiceFieldFormat constants.
fpChoiceFieldDropdown
fpChoiceFieldRadioButtons

expression.DisplayFormat

expression Required. An expression that returns a ListFieldChoice object.

DisplayFormat property as it applies to the ListFieldDateTime object.

Returns or sets an FpDateTimeFieldFormat enumerated constant that represents the way in which the date and time values are displayed. Read/write.

FpDateTimeFieldFormat can be one of these FpDateTimeFieldFormat constants.
fpDateTimeFieldDateAndTime
fpDateTimeFieldDateOnly
fpDateTimeFieldTimeOnly

expression.DisplayFormat

expression Required. An expression that returns a ListFieldDateTime object.

DisplayFormat property as it applies to the ListFieldNumber object.

Returns or sets an FpNumberFieldFormat enumerated constant that determines the way in which numbers are displayed in the List. Read/write.

FpNumberFieldFormat can be one of these FpNumberFieldFormat constants.
fpNumberFieldAuto The number will be automatically formatted.
fpNumberFieldFiveDecimals The number will be displayed with five decimal places.
fpNumberFieldFourDecimals The number will be displayed with four decimal places.
fpNumberFieldInteger The number will be displayed as an Integer with no decimal places.
fpNumberFieldOneDecimal The number will be displayed with one decimal place.
fpNumberFieldThreeDecimals The number will be displayed with three decimal places.
fpNumberFieldTwoDecimals The number will be displayed with two decimal places.

expression.DisplayFormat

expression Required. An expression that returns a ListFieldNumber object.

DisplayFormat property as it applies to the ListFieldURL object.

Returns or sets an FpURLFieldFormat enumerated constant that represents the image-linking information. Read/write.

FpURLFieldFormat can be one of these FpURLFieldFormat constants.
fpURLFieldImage
fpURLFieldLink

expression.DisplayFormat

expression Required. An expression that returns a ListFieldURL object.

Example

As it applies to the ListFieldChoice object.

The following example changes the display type of a field named NewChoiceField in the first list of the active web. The choices will now be displayed in a drop-down list.

Sub ChangeViewFormat()
'Change the display type of the field

    Dim objApp As FrontPage.Application
    Dim objListFields As ListFields
    Dim objListField As ListFieldChoice

    Set objApp = FrontPage.Application
    Set objListFields = objApp.ActiveWeb.Lists.Item(0).Fields
    Set objListField = objListFields.Item("NewChoiceField")
    'Change display format to DropDown list
    objListField.DisplayFormat = fpChoiceFieldDropdown

End Sub


Document Property

Returns a DispFPHTMLDocument object, providing access to the Page object model in Microsoft FrontPage that is compatible with Internet Explorer 4.0 and later. For more information on the Page object model, see Exploring the Object Model in FrontPage.

Example

This example opens a page and uses the insertAdjacentText method to add text to the document.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). In either case, you may substitute an alternative web URL or file. You must also have a file named Sales.htm or substitute an alternative file.

Private Sub AddTextToDoc()
    Dim myWeb As WebEx
    Dim myPageWindow As PageWindow
    Dim myText As String

    Set myWeb = _
        Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    myWeb.Activate
    myText = "Winter Sale Begins November 1st!"
    Set myPageWindow = _
        ActiveWeb.RootFolder.Files("Sales.htm").Edit

    myPageWindow.Document.body.insertAdjacentText _
        "BeforeEnd", myText

    ActivePageWindow.Save
    ActiveWeb.Close
End Sub


documentHTML Property

Returns or sets a String that represents the HTML source code for the current document. Read/write.

expression.documentHTML

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Any inserted text must be valid HTML in order to appear correctly in the document. Any text that is currently in the document will be overwritten.

Example

The following example prompts the user to enter a heading for the current document. The user input is stored in a string. The string is then formatted using HTML tags and inserted into the document as a heading.

Sub NewHeading()
'Prompts the user to enter a heaidng for the new page
'and inserts the text into the document.

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strAns As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt the user for a heading
    strAns = InputBox("Enter a heading for the new document")
    'Insert the new heading into the page
    objDoc.documentHTML = "<html><body><p><h1>" & _
                            strAns & "</h1></p></body></html>"

End Sub


domain Property

Returns or sets a String that represents the domain name of the current document. The domain represents the name of the server on which the document is located or the Web address with which it is associated. Read/write.

expression.domain

expression Required. An expression that returns a dispFPHTMLDocument object.

Example

The following example displays the domain name for the current document if a domain name exists. If the document's domain property is empty, a message is displayed to the user.

Sub DomainName()
'Displays the domain name for the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strAns As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'If domain name exists
    If objDoc.domain <> "" Then
        MsgBox "The name of the current document's domain server is " & _
               objDoc.domain & "."
    Else
       'Otherwise, display message to user
       MsgBox "The document " & objDoc.Title & _
              " does not have an associated domain name."
    End If

End Sub


DownloadTime Property

Returns a Long that represents the simulated amount of time (in seconds) a given file will take to download. Read-only.

expression.DownloadTime

expression Required. An expression that returns a WebFile object.

Remarks

This property is used in conjunction with the ConnectionSpeed property to determine which files will appear in the Slow Pages report.

Example

The following example displays the names of all files in the current web with a download time greater than a specified value. The subroutine prompts the user to enter a download time in seconds. It then searches through each file in the All collection and displays the names of any file with a download time greater than the specified number of seconds. The Name property value is added to a String containing the names of all matching files in the collection. The String stored in the variable strName, is then displayed to the user. If no matching files are found in the web, a message is displayed to the user.

Sub DownloadTime()
'Displays the names of all files with a download time greater than
'a given value

    Dim objApp As FrontPage.Application
    Dim objwebFile As WebFile
    Dim objWebFiels As WebFiles
    Dim strSec As String    'User input value
    Dim strNames As String  'Name of all matching files
    Dim blnFound As Boolean 'Boolean flag

    Set objApp = FrontPage.Application
    Set objWebFiles = objApp.ActiveWeb.AllFiles
    blnFound = False
    'Prompt user to enter input
    strSec = InputBox("Enter the number of seconds download time.")
    'Search through each file in the collection
    For Each objwebFile In objWebFiles
        'If user input is less than download time
        If strSec < objwebFile.DownloadTime Then
            blnFound = True
            If strName = "" Then
                strName = strName & objwebFile.Name
            Else
                'Otherwise add next file name to string
                strName = strName & ", " & vbCr & objwebFile.Name
            End If
        End If
    Next objwebFile

    If blnFound = True Then
       'Display names of all files that match the criteria
       MsgBox "The files that take longer than " & _
              strSec & " seconds to download are: " & vbCr & vbCr & _
              strName & "."
    Else
        'No files, display message
        MsgBox "There are no files that match your criteria."
    End If

End Sub


EditForm Property

Returns or sets a String that represents the relative URL of the form used for editing the current list in Microsoft FrontPage. The edit form allows you to modify the columns in the current list. Read/write.

expression.EditForm

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The default filename is EditForm.htm.

Example

The following example displays the names of all lists in the web and the relative URL of their associated edit forms.

Sub ViewEditFormURL()
'Displays the URL of the form
'associated with editing the list

    Dim lstWebList As List
    Dim strURL As String

    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists and add URLs to string
        For Each lstWebList In ActiveWeb.Lists
            If strURL = "" Then
                strURL = lstWebList.Name & "  -  " & _
                lstWebList.EditForm & vbCr
            Else
                strURL = strURL & lstWebList.Name & "  -  " & _
                lstWebList.EditForm & vbCr
            End If
        Next
        'Display URLs of all editing forms in web
        MsgBox "The relative URLs of the editing forms are:" _
               & vbCr & vbCr & strURL
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub


EditSecurity Property

Returns or sets an FpListEditSecurity constant that determines which users can edit the current list.

FpListEditSecurity can be one of these FpListEditSecurity constants.
fpListEditSecurityAll All users can edit the list.
fpListEditSecurityNone No users can edit the list.
fpListEditSecurityOnlyOwn Users can only edit their own lists.

expression.EditSecurity

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example changes the edit permissions of all lists of type fpListTypeBasicList to fpListEditSecurityOnlyOwn. Once the property is set, users can edit only lists that they have created.

Note Use the ApplyChanges method to save any changes made to the list.

Sub ChangeEditPermissions()
'Changes the permissions of all BasicLists in the web

    Dim objApp As FrontPage.Application
    Dim objList As Object
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists

    'Cycle through each list and check for list type
    For Each objList In objLists
        'If it's a BasicList then change permissions
        If objList.Type = fpListTypeBasicList Then
            If objList.EditSecurity <> fpListEditSecurityOnlyOwn Then
                objList.EditSecurity = fpListEditSecurityOnlyOwn
                objList.ApplyChanges
            End If
        End If
    Next

End Sub


embeds Property

Returns an IHTMLElementCollection collection object that represents a collection of all EMBED elements in the current document. The EMBED element allows you to embed documents of any type within a document.

expression.embeds

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the EMBEDS collection and displays the number of elements in the document. If no elements exist, a message is displayed to the user.

Sub EmbedsInfo()
'Returns and displays information about
'the EMBEDS elements in the current document.

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objEmbeds As IHTMLElementCollection

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    Set objEmbeds = objDoc.embeds

    'If there are EMBED elements
    If objEmbeds.Length <> 0 Then
        'If the length = 1
        If objEmbeds.Length = 1 Then
            MsgBox "There is only one " _
                    "embedded object in the current document."
        Else
            'If there are more than one
            MsgBox "There are " & objEmbeds.Length - 1 & _
                   " embedded objects in the current document."
        End If

    Else
       'Otherwise there are no embeds elements
       MsgBox "There are no embedded objects " _
               "in the current document."

    End If

End Sub


Extension Property

Returns the extension for the specified file. Read-only String.

Example

This statement returns the extension of the home page.

myHomePageExt = ActiveWeb.RootFolder.File(0).Extension


fgColor Property

Returns or sets a Variant that defines the foreground color of the current document. The foreground color corresponds to the color of the text. Read/write.

expression.fgColor

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

Valid entries are hexadecimal color values or enumerated color constants.

Example

The following example sets the foreground color of the document to the hexadecimal value corresponding to the color blue and displays a message to the user.

Sub SetFGColor()
'Sets the foreground color of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Set foreground color to blue
    objDoc.fgColor = "3333FF"
    MsgBox "The foreground color of the current document is now blue."

End Sub


Fields Property

Returns a ListFields collection that represents all fields in the current list. The ListFields collection contains ListField objects that correspond to the column properties of a list member document.

expression.Fields

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example displays the names of all fields in the first list of the Lists collection.

Sub DisplayFields()
'Returns the fields collection

    Dim objApp As FrontPage.Application
    Dim lstWebList As List
    Dim lstFields As ListFields
    Dim lstField As ListField
    Dim StrName As String

    Set objApp = FrontPage.Application
    Set lstWebList = objApp.ActiveWeb.Lists.Item(0)
    Set lstFields = lstWebList.Fields

    If Not ActiveWeb.Lists Is Nothing Then
        For Each lstField In lstFields
                'add URLs to string
                If StrName = "" Then
                    'If empty string
                    StrName = lstField.Name & vbCr
                Else
                    'add names to string
                    StrName = StrName & lstField.Name & vbCr
                End If
        Next
        'Display formatted string
        MsgBox "The list " & lstWebList.Name & _
               "contains the following fields" & vbCr & vbCr & _
               StrName

    Else
      'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub


File Property

Returns the WebFile object associated with the specified object.

expression.File

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example returns the name of the WebFile object associated with a navigation node in the active FrontPage-based web.

Private Sub GetFileFromNavNode()
    Dim myNavNode As NavigationNode
    Dim myNavNodes As NavigationNodes
    Dim myNavFiles As String
    Dim myNavFile As String
    On Error Resume Next
    Set myNavNodes = ActiveWeb.HomeNavigationNode.Children
    For Each myNavNode In myNavNodes
        myNavFile = myNavNode.File.Name
        If ERR <> 0 Then Exit Sub
        myNavFiles = myNavFiles & myNavFile & vbCrLf
    Next

End Sub


fileCreatedDate Property

Returns a String that represents the date and time the file was created. Read-only.

expression.fileCreatedDate

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the title of the file and the date and time it was created.

Sub GetCreationDate()
'Returns the creation date of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display name of file and date created.
    MsgBox "The file " & objDoc.nameProp & " was created on " & _
            objDoc.fileCreatedDate & "."

End Sub


FileDialog Property

Returns a FileDialog object which represents a single instance of a file dialog box.

expression.FileDialog(DialogType)

expression Required. An expression that returns one of the objects in the Applies To list.

DialogType Required MsoFileDialogType. The type of dialog box to open.

MsoFileDialogType can be one of these MsoFileDialogType constants.
msoFileDialogFilePicker
msoFileDialogFolderPicker
msoFileDialogOpen
msoFileDialogSaveAs

Example

The following example sets the applications dialog type to a Save As dialog box and displays the new dialog box.

Sub ShowSaveAsDialog()
'Display the Save As dialog box

    Dim dlgSaveAs As FileDialog
    'Set the dialog type
    Set dlgSaveAs = Application.FileDialog(msoFileDialogSaveAs)
    'Display the dialog
    dlgSaveAs.Show
End Sub

The following example displays the Open dialog box, and allows the user to open multiple files at the same time.

Sub ShowOpenDialog()
'Display the Open dialog box

    Dim dlgOpen As FileDialog
    'Set the dialog box type to Open
    Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
    'Display the dialog box
    With dlgOpen
        .AllowMultiSelect = True
        .Show
    End With
End Sub

The following example displays the Open dialog box, and allows the user to open multiple files at the same time. If the documents are HTML files, they are opened in Microsoft FrontPage.

Sub ShowOpenDialog()
'Display the Open dialog box

    Dim dlgOpen As FileDialog
    'Set the dialog box type to Open
    Dim i as Integer
    Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
    'Display the dialog box
    With dlgOpen
        .AllowMultiSelect = True
        .Show
    End With
    For i = 1 To dlgOpen.SelectedItems.Count
        If Right(dlgOpen.SelectedItems(i), 3) = "htm" Then
            ActiveWebWindow.PageWindows.Add dlgOpen.SelectedItems(i)
        End If
    Next
End Sub


FileDialogViewPage Property

Returns or sets a String that represents the relative URL of the page associated with the DocumentLibrary object. Read/write.

expression.FileDialogViewPage

expression Required. An expression that returns a DocumentLibrary object.

Example

The following example creates a new document library called NewLibrary and displays the relative URL of the File dialog page.

Sub NewLibrary()
'Add a new list to the current web

    Dim objApp As FrontPage.Application
    Dim objLists As Lists
    Dim objLibrary As DocumentLibrary

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists
    'Add new list
    objLists.Add Name:="NewLibrary", _
                 ListType:=fpListTypeDocumentLibrary, _
                 Description:="List of Shared files"
    Set objLibrary = objLists.Item("NewLibrary")

    'Display message to user
    MsgBox "A new list was added to the Lists collection." & _
           "The page associated with the file dialog is " & _
            objLibrary.FileDialogViewPage & "."

End Sub


fileModifiedDate Property

Returns a String that represents the date and time that the current document was last modified. Read-only.

expression.fileModifiedDate

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the title of the document and the date and time it was last modified.

Sub GetModifiedDate()
'Returns the modification date of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display name of file and date last modified.
    MsgBox "The file " & objDoc.nameProp & " was last modified on " & _
            objDoc.fileModifiedDate & "."

End Sub


Files Property

Some of the content in this topic may not be applicable to some languages.

Returns the items in the WebFiles collection. Read-only Object.

Remarks

The Files property is a pointer to the WebFiles collection. To access the collection, declare a variable of type WebFiles as shown in the statement, Dim myFiles As WebFiles, and then set the variable myFiles to Web.RootFolder.Files.

Example

This example retrieves all of the properties of a file and concatenates the META tags into a string with a pipe ("|") delimiter separating the data.

Note The PropertyKeys shown in this example apply to a web created with the One Page Only Web Wizard. Other templates may use other PropertyKeys.

Private Sub GetFileProperties()
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myAuthor As String
    Dim myModifiedBy As String
    Dim myTimeCreated As String
    Dim myTimeLastModified As String
    Dim myFileSize As String
    Dim myTitle As String
    Dim myMetaTags As Variant
    Dim myMetaTag As Variant
    Dim myProgID As Variant
    Dim myGenerator As String
    Dim myTimeLastWritten As String
    Dim myProperties As Properties
    Dim myMetaTagList As String

    Set myFiles = ActiveWeb.RootFolder.Files

    For Each myFile In myFiles
        Set myProperties = myFile.Properties
        myAuthor = myAuthor & myProperties("vti_author")
        myModifiedBy = myModifiedBy & _
            myProperties("vti_modifiedby) & "|"
        myTimeCreated = myTimeCreated & _
            myProperties("vti_timecreated") & "|"
        myTimeLastModified = myTimeLastModified & _
            myProperties("vti_timelastmodified") & "|"
        myFileSize = myFileSize & _
            myProperties("vti_FileSize) & "|"
        myTitle = myTitle & myProperties("vti_title") & "|"
        myProgID = myProgID & myProperties("vti_title") & "|"
        myGenerator = myGenerator & _
            myProperties("vti_generator") & "|"
        myTimeLastWritten = myTimeLastWritten & _
            myProperties("vti_timelastwritten") & "|"
        myMetaTags = myProperties("vti_metatags")
        For Each myMetaTag In myMetaTags
            myMetaTagList = myMetaTagList & myMetaTag & "|"
        Next
    Next
End Sub


FileSaveForm Property

Returns or sets a String that represents the relative URL of the form page that is displayed when files are saved. Read/write.

expression.FileSaveForm

expression Required. An expression that returns a DocumentLibrary object.

Example

The following example creates a new document library called NewLibrary and displays the relative URL of the page associated with saving a file to the library.

Sub NewLibrary()
'Adds a new list to the current web

    Dim objApp As FrontPage.Application
    Dim objLists As Lists
    Dim objLibrary As DocumentLibrary

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists
    'Add new list
    objLists.Add Name:="NewLibrary", _
                 ListType:=fpListTypeDocumentLibrary, _
                 Description:="List of Shared files"
    Set objLibrary = objLists.Item("NewLibrary")

    'Display message to user
    MsgBox "A new list was added to the Lists collection." & _
           "The URL of the page associated with the Save dialog is " & _
            objLibrary.FileSaveForm & "."

End Sub


FileSearch Property

Returns the FileSearch object.

Remarks

The FileSearch object does not accept a uniform resource locator (URL) as a file name or folder name value.

Example

This example searches the Adventure Works web and its subdirectories and returns the number of Index.htm files found in the web.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Adventure Works" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Adventure Works" (for a server running on Windows NT). As an alternative, you can change the value for LookIn to a web that is currently available to you. You must also set a reference to Microsoft Office Object Library.

Private Sub WebFileSearch()
    Dim myFileSearch As FileSearch
    Dim myFileCount As Integer

    Set myFileSearch = Application.FileSearch

    With myFileSearch
            .FileName = "index.htm"
            .LookIn = "C:\My Webs\Adventure Works"
            .SearchSubFolders = True
            .Execute
            myFileCount = .FoundFiles.Count
    End With
End Sub


fileSize Property

Returns a String that represents the file size, in kilobytes, of the current document. Read-only.

expression.fileSize

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the name and file size of the current document.

Sub GetFileSize()
'Returns the file size of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display name of file and the file size.
    MsgBox "The file size of " & objDoc.nameProp & " is " & _
            objDoc.fileSize & " kb."

End Sub


fileUpdatedDate Property

Returns a String that represents the date and time that the current document was last updated. Read-only.

expression.fileUpdatedDate

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the name of the file and the date and time it was last updated.

Sub GetFilelastUpdate()
'Returns the date that the file was last updated

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Displays date the file was last updated.
    MsgBox "The file " & objDoc.nameProp & " was last updated " & _
            objDoc.fileUpdatedDate & "."

End Sub


Folder Property

Returns a WebFolder object that represents the folder associated with the list. The web folder hierarchy provides the link to folders and files on a Web server directory. The navigation structure provides the underlying structure for the Web objects within individual Microsoft FrontPage webs.

expression.Folder

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example displays the name of the web folder associated with the current list. If the current web contains no lists, a message is displayed to the user.

Sub ReturnFolder()
'Returns the folder associated with the List

    Dim objApp As FrontPage.Application
    Dim objFolder As WebFolder

    Set objApp = FrontPage.Application

    If Not objApp.ActiveWeb.Lists Is Nothing Then
        Set objFolder = objApp.ActiveWeb.Lists(0).Folder
        MsgBox "The name of the associated web folder is: " & _
                objFolder.Name & "."
    Else
        MsgBox "The Active web contains no lists."
    End If

End Sub


Folders Property

Some of the content in this topic may not be applicable to some languages.

Returns the items in the WebFolders collection. Read-only.

Remarks

The Folders property returns the WebFolders collection for the specified web. To access the collection, you declare a variable of type WebFolders as in the statement, Dim myFolders As WebFolders, and then set the variable to Web.RootFolder.Folders.

Example

This example retrieves two of the properties of a folder and concatenates the data into a string with a pipe ("|") delimiter separating the data.

Note The PropertyKeys shown in this example apply to a web created with the One Page Only Web Wizard. Other templates may use other PropertyKeys.

Private Sub GetFolderProperties()
    Dim myFolders As WebFolders
    Dim myFolder As WebFolder
    Dim myHasSubDirs As String
    Dim myIsScriptable As String
    Dim myProperties As Properties

    Set myFolders = ActiveWeb.RootFolder.Folders

    For Each myFolder In myFolders
            Set myProperties = myFolder.Properties

            myHasSubDirs = myHasSubDirs & _
                        myProperties("vti_ hassubdirs") & "|"
            myIsScriptable = myIsScriptable & _
                        myProperties("vti_ isscriptable") & "|"
    Next
End Sub


Format Property

Returns the format of the specified Theme object. Read-only String.

Remarks

The theme format reflects the difference between the formats for the different versions of Microsoft FrontPage. For example, the format number for FrontPage 98 can be either 0.0 or 1.0, while the format number for FrontPage 2000 is 2.0, and so on.

Example

This example retrieves the format of the applied theme for the active web.

Private Sub GetThemeFormat()
    Dim myFormat As String

    myFormat = ActiveWeb.Themes(0).Format
End Sub


forms Property

Returns an IHTMLElementCollection collection object that represents a collection of all forms in the current document.

expression.forms

expression Required. An expression that returns a DispFPFPHTMLDocument object..

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example returns the collection of all forms in the current document. The subroutine searches through the collection for a form named Project Name Form. If the form is found, its name and index value are displayed to the user.

Sub ReturnForms()
'Returns the collection of forms in the document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objForms As IHTMLElementCollection
    Dim objForm As IHTMLFormElement
    Dim intCount As Integer

    intCount = 0
    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Create a reference to the forms collection
    Set objForms = objDoc.forms

    For Each objForm In objForms
        'If form is the project name form
        If objForm.Name = "Project Name Form" Then
            'Display name and position
            MsgBox "The form " & objForm.Name & " was found." & _
                   " It is positioned number " & intCount _
                   & " in the collection."
        End If
    'If not found, keep looking
    intCount = intCount + 1
    Next objForm

End Sub


frames Property

Returns an IHTMLFramesCollection2 collection that represents the collection of all windows defined by the given document or defined by the document associated with a given window.

expression.frames

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

Although you can use names with the item property on this collection, the method never returns a collection. Instead, it always returns the first window with the specified name. To ensure that all windows are accessible, you should always make sure that no two frames in a document have the same name.

Example

The following example displays the name and location of all frames in the current document. If the document contains no frames, a message is displayed to the user.

Sub ReturnFrames()
'Returns the collection of all window objects defined in the
'current document.

    Dim objFrm As IHTMLFramesCollection2
    Dim i as Integer

    Set objFrm = ActiveDocument.frames
    'If there are frames in the document
    If Not objFrm.Length = 0 Then
        'For every frame in the collection
        For i = 0 To objFrm.Length - 1
            'Display name and location
            MsgBox "The window " & objFrm(i).Name & _
                   "has the path: " & objFrm(i).location
        Next i
    Else
        'Otherwise display message
        MsgBox "There are no frames in the current document."
    End If
End Sub


FrameWindow Property

Returns an FPHTMLWindow2 object. The Document property of the FPHTMLWindow2 object points to the DispFPHTMLDocument object of the frames page.

expression.FrameWindow

expression Required. An expression that returns a PageWindowEx object.

Example

This example retrieves the IHTMLLocation property of the FrameWindow object.

Private Sub GetFrameWindowLocation()
    Dim myWeb As WebEx
    Dim myPage As PageWindowEx
    Dim myFrameWindowLocation As String

    Set myWeb = Webs("C:\My Webs\Rogue Cellars")
    Set myPage = _
                myWeb.ActiveWebWindow.ActivePageWindow
    myFrameWindowLocation = myPage.FrameWindow.Location.href
End Sub


hasSharedBorders Property

Returns a Boolean that determines if elements within the document share borders with each other. If True, two elements share the same border. If False, no elements within the current document share a border. Read-only.

expression.hasSharedBorders

expression Required. An expression that returns a DispFPHTMLDocument.

Example

The following example displays a message to the user stating whether or not elements within the document share a common border.

Sub SharedBorders()
'Determines if the current document has shared borders

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Check if document has shared borders
    If objDoc.hasSharedBorders = True Then
        'If yes, display message
        MsgBox "The current document, " & objDoc.nameProp & _
               ", has shared borders."
    Else
        'If no, display message
        MsgBox "The current document, " & objDoc.nameProp & _
               ", does not have shared borders."
    End If
End Sub


Home Property

Returns a read-only HomeNavigationNode object for the NavigationNode object.

Example

This example searches for a navigation node with the label "Sale", and then updates it.

Private Sub ChangeNavLabel()
    Dim myFiles As WebFiles
    Dim myFile As WebFile

    Set myFiles = ActiveWeb.RootFolder.Files

    For Each myFile In myFiles
        If myFile.NavigationNode.Home.Label = "Sale" Then
            myFile.NavigationNode.Home.Label = "Sales Items"
        End If
    Next
End Sub


HomeNavigationNode Property

Returns a NavigationNode object for the home page.

Remarks

The home navigation node is the starting point for all navigation addressing within the navigation structure. Whenever you want to add, move, or delete a node, change any of the attributes for a node, or just access the current navigation structure, you use the HomeNavigationNode object as a starting point. The only time you would use the RootNavigationNode object to access the navigation structure is when you want to add or access a navigation node at the same level as the HomeNavigationNode object.

Example

This example accesses the HomeNavigationNode object and retrieves the URL for the home page.

Private Sub GetHomeNavigationNode()
    Dim myWeb As WebEx
    Dim myHomeNode As NavigationNode
    Dim myHomeUrl As String

    Set myWeb = ActiveWeb

    myHomeNode = myWeb.HomeNavigationNode
    myHomeUrl = myHomeNode.Url
End Sub


HorizontalResolution Property

Returns the horizontal resolution of the screen in pixels. Read-only Long.

Example

This example returns the horizontal resolution of the screen.

myHoriz = System.HorizontalResolution


htmlViewText Property

Returns or sets a String that represents the HTML view text for the current document. Read/write.

expression.htmlViewText

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example prints out the HTML view text in the Immediate window. The following example assumes that the user is in HTML view.

Sub HTMLViewtext()
'Displays the HTML view text

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display view text in immediate window
    Debug.Print objDoc.htmlViewtext

End Sub


ignoreSharedBorders Property

Returns or sets a Boolean that determines if element borders that are shared by multiple elements will be ignored. Read/write.

expression.ignoreSharedBorders

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example sets the ignoreSharedBorders property to True if shared borders exist in the current document. If shared borders do not exist in the document, the ignoreSharedBorders property is set to False. Any future elements with shared borders will therefore not be ignored.

Sub IgnoreBorders()
'Ignores shared borders in document if they exist

    Dim objApp As FrontPage.Application
    'If document has shared borders, ignore them
    If objApp.ActiveDocument.hasSharedBorders = True Then
       objApp.ActiveDocument.ignoreSharedBorders = True
    Else
    'Don't ignore shared borders until they occur
    If objApp.ActiveDocument.hasSharedBorders = False Then
       objApp.ActiveDocument.ignoreSharedBorders = False
    End If

End Sub


images Property

Returns an IHTMLElementCollection collection that represents the collection of all images in the current document. Images are denoted by their HTML tag <IMG>.

expression.images

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example creates a reference to the images collection and displays the titles of all images in the current document. If no titles exist for any of the images, nothing is displayed to the user.

Sub ReturnImages()
'Returns the collection of all images in the collection

    Dim objApp As FrontPage.Application
    Dim objImages As IHTMLElementCollection
    Dim objImage As IHTMLElement

    Set objApp = FrontPage.Application
    Set objImages = objApp.ActiveDocument.images

    For Each objImage In objImages
        'If title string is not empty
        If Not objImage.Title = "" Then
            'Display title of each image
            MsgBox objImage.Title
        End If
    Next objImage

End Sub


InNavBars Property

Returns or sets a Boolean that determines if the current page will be visible in the web's navigation bars. A navigation bar is a set of hyperlinks used for navigating a Web site. Read/write.

expression.InNavBars

expression Required. An expression that returns a NavigationNode object.

Remarks

If True, the current page will appear in the navigation bar. If False, the current page will not appear in the navigation bar. All pages with the InNavBars property set to False will appear grayed out in Navigation view.

Example

The following example prompts the user to select which navigation nodes will appear in the navigation bar. If the user selects Yes, the current page will appear in the navigation bar. If the user selects No, the current page will not appear in the navigation bar and will appear grayed out in Navigation view. The user is prompted for each navigation node in the web.

Sub AllNavigationNodes()
'Return a collection of all navigation nodes used in the current web
'Allows you to select which pages will appear in the navigation bar

    Dim objApp As FrontPage.Application
    Dim objNavNode As NavigationNode
    Dim objNavNodes As NavigationNodes
    Dim strAns As String

    Set objApp = FrontPage.Application
    'Create a reference to the NavigationNodes collection
    Set objNavNodes = objApp.ActiveWeb.AllNavigationNodes
    'For each node in the collection
    For Each objNavNode In objNavNodes
        'Prompt the user
        strAns = MsgBox("Do you want the page " & objNavNode.Label & _
               " to appear in the navigation bar?", vbYesNo)
        'If user answers yes, set to True
        If strAns = vbYes Then
            objNavNode.InNavBars = True
        Else
            'If no, set to False
            objNavNode.InNavBars = False
        End If
    'Go to next node
    Next objNavNode
End Sub


IsDirty Property

True if the PageWindowEx object has changed since the last time the object was saved. Read-write Boolean.

expression.IsDirty

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example checks if the active page has changed; if it has, the program executes the Save method for the active page.

Private Sub DirtyDocument()
    Dim myPage As PageWindowEx
    Dim myDoc As DispFPHTMLDocument
    Dim mySaveCheck As Boolean

    Set myDoc = WebWindows(0).PageWindows(0).Document

    Call myDoc.body.insertAdjacentHTML("BeforeEnd", _
                "<b> modified </b>")
    If ActivePageWindow.IsDirty = True Then
            ActivePageWindow.Save
    End If
End Sub


IsExecutable Property

Returns the setting for execute permission for a WebFolder object. Read/write Boolean.

Example

This example retrieves the setting of the IsExecutable property for a WebFolder object.

Private Sub CheckExecutable()
    Dim myFolder As WebFolder
    Dim myExeStatus As Boolean

    Set myFolder = ActiveWeb.RootFolder.Folders("images")
    myExeStatus = myFolder.IsExecutable

End Sub


IsHiddenFoldersEnabled Property

Returns or sets a Boolean that determines if hidden folders will appear in the current web. Read/write.

expression.IsHiddenFoldersEnabled

expression Required. An expression that returns a WebEx object.

Example

The following example prompts the user to display hidden folders in the current web. The IsHiddenFoldersEnabled property is set based on the user's response.

Sub ViewAllFolders()
'Prompts the user to view hidden folders

    Dim objApp As FrontPage.Application
    Dim objWeb As WebEx
    Dim strAns As String

    Set objApp = FrontPage.Application
    Set objWeb = objApp.ActiveWeb
    'prompt user
    strAns = MsgBox("Do you want to view hidden folders?", vbYesNo)
    'Set value of property to match user's response
    If strAns = vbYes Then
        objWeb.IsHiddenFoldersEnabled = True
    Else
        objWeb.IsHiddenFoldersEnabled = False
    End If

End Sub


IsLinkBar Property

Returns a Boolean that indicates if the current navigation node is a link bar. Link bars provide hypertext links that allow you to navigate through the pages in the current web. Read-only.

expression.IsLinkBar

expression Required. An expression that returns a NavigationNode object.

Remarks

If False, the navigation node is not a link bar. If True, the navigation node is a link bar.

Example

The following example traverses through the navigation node hierarchy and displays the names of any link bars in the web. If no link bars are found a message is displayed to the user. Whether or not a navigation node is a link bar is determined by its IsLinkBar property.

Sub DisplayLinkBar()
'Return a collection of all navigation nodes used in the current web
'Searches through the collection and displays the names of all link bars

    Dim objApp As FrontPage.Application
    Dim objNavNode As NavigationNode
    Dim objNavNodes As NavigationNodes
    Dim strAns As String
    Dim blnFound As Boolean

    blnFound = False
    Set objApp = FrontPage.Application
    'Create a reference to the NavigationNodes collection
    Set objNavNodes = objApp.ActiveWeb.AllNavigationNodes
    'For each node in the collection
    For Each objNavNode In objNavNodes
       'If set to True, this is a link bar
       If objNavNode.IsLinkBar = True Then
           MsgBox objNavNode.Label & " is a link bar."
           blnFound = True
       End If
    'Go to next node
    Next objNavNode
    'If no link bars are found, display a message
    If blnFound = False Then
        MsgBox "There are no link bars in the current web."
    End If
End Sub


IsOpen Property

True if the active WebFile object is open. Read-only Boolean.

Example

This example uses the IsOpen property to check if a file is open.

Private Sub CheckForOpenFile()
    Dim myWeb As WebEx
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myFileToOpen As String
    Dim myMessage As String
    Dim myFileName As String

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    myFileToOpen = "index.htm"
    myMessage = "This file is open, try again later."

    With myWeb
        For Each myFile In myFiles
            If myFileName = myFileToOpen Then
                If myFile.IsOpen = True Then
                    MsgBox (myMessage)
                    Exit Sub
                Else
                    myFile.Open (fpPageViewNormal)
                    Exit Sub
                End If
            End If
        Next
    End With
End Sub


IsOrphan Property

Returns a Boolean that determines if the current page is an orphan. An orphan page is a page that cannot be reached by hyperlinks from the Home Page. Read-only.

expression.IsOrphan

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

If True, the page cannot be reached from the Home Page. If False, the page can be reached from the Home Page.

Example

The following example searches through the current web and displays the names of all orphan files. An orphan file is denoted by its IsOrphan property. Once a file is found with an IsOrphan property that equals True, the Label property value is added to a String containing the names of all orphan nodes in the web. The String stored in the variable strName, is then displayed to the user. If no orphan nodes are found in the web, a message is displayed to the user.

Sub ListOrphans()
'Displays the names of orphan files.

    Dim objApp As FrontPage.Application
    Dim objWebFile As WebFile
    Dim strName As String
    Dim blnFound As Boolean

    Set objApp = FrontPage.Application

    blnFound = False
    'For each file in the web
    For Each objWebFile In ActiveWeb.AllFiles
        'Check if the file is an orpahn
        If objWebFile.IsOrphan Then
           blnFound = True
           If strName = "" Then
               strName = strName & objWebFile.Name
           Else
               'otherwise add next node label to string
               strName = strName & ", " & vbCr & objWebFile.Name
           End If
         End If
    Next

    If blnFound = True Then
       'Display names of all orphan pages
       MsgBox "The orphan pages in the current web are: " & vbCr & vbCr & _
              strName & "."
    Else
        'No orphans, display message
        MsgBox "There are no orphan pages in the web."
    End If

End Sub


IsReadable Property

Returns the setting for read permission for a WebFolder object. Read/write Boolean.

Example

This example retrieves the setting of the IsReadable property for a WebFolder object.

Private Sub CheckReadable()
    Dim myFolder As WebFolder
    Dim myReadStatus As Boolean

    Set myFolder = ActiveWeb.RootFolder.Folders("images")
    myReadStatus = myFolder.IsReadable

End Sub


IsRoot Property

Returns the setting for whether a WebFolder object is the root web. Read-only Boolean.

Example

This example retrieves the setting of the IsRoot property for a WebFolder object.

Private Sub CheckExecutable()
    Dim myFolder As WebFolder
    Dim myIsRoot As Boolean

    Set myFolder = ActiveWeb.RootFolder.Folders("images")
    myIsRoot = myFolder.IsRoot

End Sub


IsUnderRevisionControl Property

True if source control is used on the active WebEx object. Read-only Boolean.

Remarks

You must have a source control project created through Microsoft Visual SourceSafe or Microsoft Office in order to use revision control.

Example

This example creates a source control project and then, in the second procedure, checks the state of IsUnderRevisionControl property.

Private Sub SourceControlProject()
    Dim myWeb As WebEx

    Set myWeb = ActiveWeb

    If Not (myWeb.IsUnderRevisionControl) Then
        myWeb.RevisionControlProject = _
            "<FrontPage-based Locking>"
    End If
End Sub

Private Sub GetRevisionState()
    Dim myWeb As WebEx
    Dim myRevCtrlProj As String
    Dim myIsRevCtrl As Boolean

    Set myWeb = ActiveWeb

    With myWeb
        myRevCtrlProj = .RevisionControlProject
        myIsUnderRevCtrl = .IsUnderRevisionControl
    End With
End Sub


IsWeb Property

Returns the setting for whether a WebFolder object is a web. Read-only Boolean.

Example

This example retrieves the setting of the IsWeb property for a WebFolder object.

Private Sub CheckExecutable()
    Dim myFolder As WebFolder
    Dim myWebStatus As Boolean

    Set myFolder = ActiveWeb.RootFolder.Folders("images")
    myWebStatus = myFolder.IsWeb

End Sub


IsWritable Property

Returns the setting for write permission for a WebFolder object. Read-only Boolean.

Example

This example retrieves the setting of the IsWritable property for a WebFolder object.

Private Sub CheckExecutable()
    Dim myFolder As WebFolder
    Dim myWritableStatus As Boolean

    Set myFolder = ActiveWeb.RootFolder.Folders("images")
    myWritableStatus = myFolder.IsWritable

End Sub


Item Property

Item property as it applies to the Lists object.

Returns a List object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

Item property as it applies to the ListFields object.

Returns a ListField object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

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. Required String. A string that contains an index number of the collection. The index starts at zero.

Item property as it applies to the NavigationNodes object.

Returns a NavigationNode object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

Item property as it applies to the PageWindows object.

Returns a PageWindowEx object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

Item property as it applies to the Themes object.

Returns a Theme object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

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 the Webs object.

Returns a WebEx object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

Item property as it applies to the WebFiles object.

Returns a WebFile object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

Item property as it applies to the WebFolders object.

Returns a WebFolder object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

Item property as it applies to the WebWindows object.

Returns a WebWindowEx object.

expression.Item(Index)

expression Required. An expression that returns one of the above objects.

Index Required Variant. The name or ordinal value of the object within the collection.

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


Label Property

Returns the label associated with the active navigation node. This label is used as a reference for individual navigation nodes in Navigation view or as the name of a theme. Read/write String.

Remarks

Use the text in a Label object for the text in a banner or button that links to another navigation node in the navigation structure.

Example

This example sets the text for the label of the first child node. The label shows the placement of the node in Navigation view.

Private Sub AddLabelToNavigationNode()
    Dim myNode As NavigationNode
    Set myNode = ActiveWeb.HomeNavigationNode.Children(0)

    myNewNode.Label = “Finance Page”
End Sub

This example retrieves the name of a theme.

Note To run this procedure, you must have an open web with a page that has previously had a theme applied to it.

Private Sub GetThemeName()
    Dim myTheme As String

    myTheme = ActiveWeb.Themes(0).Label
End Sub


LanguageDesignation Property

Returns the abbreviated name of the designated language of the system software. Read-only String.

Remarks

Using the two-letter language abbreviation from the ISO Standard 639 and adding a third letter, such as “u” for the United States, creates the three- letter abbreviation.

You can also get the two-letter language abbreviation with GetLocaleInfo() by specifying LOCALE_SABBREVLANGNAME as the LCType. The abbreviated name ”enu” is returned for the English (US) language and is the same abbreviation that is returned with the LanguageDesignation property.

Example

This example displays the abbreviated name of the designated language of the system software.

myLang = System.LanguageDesignation


LanguageSettings Property

Returns the LanguageSettings object for the Microsoft FrontPage application. Read-only LanguageSettings.

Example

This example returns the LanguageID property for the user interface and sets the LanguagePreferredForEditing properties.

Note The LanguageSettings property has a required constant called MsoAppLanguageID. The enumerated values for this constant are msoLanguageIDHelp, msoLanguageIDInstall, msoLanguageIDUI, and msoLanguageIDUIPrevious. The LanguagePreferredForEditing property also has enumerated constants for the available languages. For more detailed information see the LanguageSettings object.

Private Sub GetLanguageInfo()
    Dim myLSet As LanguageSettings
    Dim myLangID As String
    Dim prfLang As String

    Set myLSet = Application.LanguageSettings

    With myLSet
        myLangID = .LanguageID(msoLanguageIDUI)
        prfLang = _
                .LanguagePreferredForEditing(msoLanguageIDEnglishUS) _
                = True
    End With
End Sub


lastModified Property

Returns a String that represents the date and time that the current document was last modified. Read-only.

expression.lastModified

expression Required. An expression that returns a DispFPHTMLDocument.

Example

The following example displays the name of the file and the date on which it was last modified.

Sub GetLastModifiedDate()
'Returns the last modification date of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display name of file and date last modified.
    MsgBox "The file " & objDoc.nameProp & " was last modified on " & _
            objDoc.lastModified & "."

End Sub


linkColor Property

Returns or sets a Variant that determines the color of all links in the current document. The variant corresponds to a hexadecimal color value or an enumerated color constant. Read/write.

expression.linkColor

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example sets the color of all links in the active document to blue.

Sub ChangeLinkColor()
'Changes the color of links in the current document

    Dim objApp As FrontPage.Application
    Set objApp = FrontPage.Application
    'Set color of links to blue
    objApp.ActiveDocument.linkColor = "3333FF"

End Sub


links Property

Returns an IHTMLElementCollection collection that represents the collection of all links in the current document.

expression.links

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example returns the collection of all links in the document and displays the number of links in the collection.

Sub ReturnLinks()
'Returns the collection of all links in the document

    Dim objApp As FrontPage.Application
    Dim objLinks As IHTMLElementCollection

    Set objApp = FrontPage.Application
    Set objLinks = objApp.ActiveDocument.links

    'If not 0 links exist in the document
    If Not objLinks.Length = 0 Then
        'If only one link exists
        If objLinks.Length = 1 Then
            MsgBox "There is only one link in the collection."
        'If more than one link exists
        ElseIf objLinks.Length > 1 Then
            MsgBox "There are " & objLinks.Length & _
                   " hyperlinks in the current document."
        End If
    Else
       'Otherwise display message to user.
        MsgBox "There are no links in the collection."
    End If

End Sub


List Property

Returns a List object that represents the list associated with the current folder.

expression.List

expression Required. An expression that returns a WebFolder object.

Example

The following example returns the list object associated with the second folder in the active web and displays the names of all fields in the list.

Sub ReturnList()
    'Returns the list associated with a folder

    Dim objApp As FrontPage.Application
    Dim objFolder As WebFolder
    Dim objListField As ListField
    Dim objList As List
    Dim strName As String

    Set objApp = FrontPage.Application
    For Each objFolder In objApp.ActiveWeb.AllFolders
        If Not objFolder.List Is Nothing Then
            'Return the List using the List property
            Set objList = objFolder.List
            For Each objListField In objList.Fields

                'Add list names to string
                If strName = "" Then
                    strName = objListField.Name & vbCr
                Else
                    strName = strName & objListField.Name & vbCr
                End If

            Next
            MsgBox "The field names within the" & objList.Name & " list are: " & vbCr & _
            strName
        End If
    Next
End Sub


Lists Property

Returns a Lists collection object that represents a collection of all lists in the current web. A list can be either a DocumentLibrary object, BasicList object or a Survey object.

expression.Lists

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example returns a reference to the Lists collection using the web object's Lists property. The example displays the name of each list in the collection.

Sub ViewLists()
'Returns a collection of all lists in the web

    Dim objApp As FrontPage.Application
    Dim objWeb As WebEx
    Dim objlists As Lists
    Dim objlist As List
    Set objApp = FrontPage.Application
    Set objWeb = objApp.ActiveWeb
    'Reference the Lists collection
    Set objlists = objWeb.Lists
    'display the name of each list in the Lists collection
    For i = 1 To objlists.Count
        MsgBox "The name of the list is " & objlists.Item(i).Name
    Next i

End Sub


location Property

Returns an FPHTMLLocation object that represents the location information of the current document. The FPHTMLocation object contains information about the location of the document such as the path, port and protocol of the document.

expression.location

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example returns the location object and displays the path of the document.

Sub ReturnLocation()
'Returns the location information of the current document.

    Dim objApp As FrontPage.Application
    Dim objLocation As FPHTMLLocation
    Set objApp = FrontPage.Application
    Set objLocation = objApp.ActiveDocument.location
    'Display location information to user.
    MsgBox "The path of the current document is: " & objLocation.pathname

End Sub


LookupField Property

Returns a ListField object that defines the field on which the search is performed.

expression.LookupField

expression Required. An expression that returns a ListFieldLookup object.

Example

The following example creates a new field of type fpFieldLookup and displays the name of the new field and the name of the field that is being searched.

Sub CreateLookup()
'Adds new Lookup field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As listFields
    Dim objFldLookup As ListFieldLookup
    Dim ObjField As ListField
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewFileLookupField"
    'Add new Field of type fpFieldLookup to list
    objLstFlds.Add Name:=strName, Description:="New Lookup Field", _
                   Fieldtype:=fpFieldLookup
    Set objFldLookup = objLstFlds.Item("NewFileLookupField")
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & ". The field used for the " & _
           "lookup is " & objFldLookup.LookupField.Name & "."

End Sub


MaximumValue Property

Returns or sets a Variant that specifies the maximum value allowed for this field. This property is the equivalent of setting the Maximum value allowed field in the Modify Field dialog box of the user interface. Read/write.

expression.MaximumValue

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

An error message will be displayed to the user if invalid data is entered into this field. Use the MinimumValue property value to set the minimum value for the field.

Example

The following example displays the names and maximum values of all fields of type fpFieldNumber and fpFieldCurrency. If the list contains no fields of this type, a message is displayed to the user.

Sub DisplayMaximum()
'Displays the maximum value of all ListFieldNumber
'and ListFieldCurrency fields in the list

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String
    Dim objLstFld As Object
    Dim strValues As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    'Cycle through lists and add value to string
    For Each objLstFld In objLstFlds
        If (objLstFld.Type = fpFieldNumber) Or (objLstFld.Type = fpFieldCurrency) Then
            strValues = strValues & objLstFld.Name & vbTab & _
                        objLstFld.MaximumValue & vbCr
        End If
    Next objLstFld

    If strValues <> "" Then
        MsgBox "The fields and their maximum values are:" & vbCr & _
                vbCr & strValues
    Else
        MsgBox "There are no ListFieldNumber or ListFieldCurrency Fields in the current list."
    End If

End Sub

The following example changes the maximum value of all fields of type ListFieldNumber to a constant with the value 200.

Note Use the ApplyChanges method to apply any changes made to the list.

Sub ChangeMaximum()
'Changes maximum value for all fields of type
'ListFieldNumber

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String
    Dim objLstFld As Object
    Const varMax As Variant = 200

    Set objApp = FrontPage.Application
    If objApp.ActiveWeb.Lists.Count > 0 Then
        Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
        'Cycle through lists and change values
        For Each objLstFld In objLstFlds
            If objLstFld.Type = fpFieldNumber Then
                objLstFld.MaximumValue = varMax
            End If
        Next objLstFld
        objApp.ActiveWeb.Lists(0).ApplyChanges
    Else
        MsgBox "The active web contains no lists."
    End If
End Sub


MaxLength Property

Returns or sets a Long that represents the maximum length (in characters) of the field. Read/write.

expression.MaxLength

expression Required. An expression that returns a ListFieldSingleLine object.

Example

The following example adds a new field of type fpFieldSingleLine to the ListFields collection and displays the name of the new field, the list to which it was added, and the maximum length in characters of the new field.

Sub CreateSingleLineField()
'Add new SingleLineField
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim objListField As ListFieldSingleLine
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "AlternativeName"
    'Add new field of type fpFieldSingleLine to list
    objLstFlds.Add Name:=strName, Description:="Numeric Total Field", _
                   Fieldtype:=fpFieldSingleLine
    Set objListField = objLstFlds.Item("AlternativeName")
    MsgBox "A new field named " & strName & _
           " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name &
            _ ". The maximum length of the " & _
           "field is " & objListField.MaxLength & " characters."

End Sub


MetaTags Property

Returns the MetaTags collection for the specified WebFile object.

Example

This example iterates through the META tags collection and concatenates the file names and META tag names into a string called myReturnInfo.

Private Sub GetMetaTagInfo_Click()
    Dim myWeb As WebEx
    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
                Next
            Next
    End With
End Sub


mimeType Property

Returns a String that represents the MIME (Multipurpose Internet Mail Extension) type of the current document. Read-only.

expression.mimeType

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the MIME type used by the current document.

Sub DisplayMimetype()
'Displays the MIME type of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display document's MIME type
    MsgBox "The current document's MIME type is " & objDoc.mimeType & "."

End Sub


MinimumValue Property

Returns or sets a Variant that specifies the minimum allowed value for the field. This property is the equivalent of setting the Minimum value allowed field in the Modify Field dialog box of the user interface. Read/write.

expression.MinimumValue

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

An error message will be displayed to the user if invalid information is entered into this field. Use the MaximumValue property to set the maximum allowed value of the field.

Example

The following example displays the names and minimum values for all fields of type fpFieldNumber and fpFieldCurrency in the first list of the web.

Sub DisplayMinimum()
'Displays the minimum value of all ListFieldNumber
'and ListFieldCurrency fields in the list

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String
    Dim objLstFld As Object
    Dim strValues As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    'Cycle through lists and add value to string
    For Each objLstFld In objLstFlds
        If (objLstFld.Type = fpFieldNumber) Or (objLstFld.Type = fpFieldCurrency) Then
            strValues = strValues & objLstFld.Name & vbTab & _
                        objLstFld.MinimumValue & vbCr
        End If
    Next objLstFld

    If strValues <> "" Then
        MsgBox "The fields and their minimum values are:" & vbCr & _
                vbCr & strValues
    Else
        MsgBox "There are no ListFieldNumber or ListFieldCurrency Fields in the current list."
    End If

End Sub

The following example changes the minimum value of all fields of type fpListFieldNumber in the list to a constant with the value 200.

Note Use the ApplyChanges method to apply any changes made to the list.

Sub ChangeMinimum()
'Changes minimum value for all fields of type
'ListFieldNumber

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String
    Dim objLstFld As Object
    Const varMin As Variant = 1

    Set objApp = FrontPage.Application
    If objApp.ActiveWeb.Lists.Count > 0 Then
        Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
        'Cycle through lists and change values
        For Each objLstFld In objLstFlds
            If objLstFld.Type = fpFieldNumber Then
                objLstFld.MinimumValue = varMin
            End If
        Next objLstFld
        objApp.ActiveWeb.Lists(0).ApplyChanges
    Else
        MsgBox "The active web contains no lists."
    End If
End Sub


MonthsShown Property

Returns or sets a Long that determines how many months will be displayed in the Microsoft FrontPage Reports view. Read/write.

expression.MonthsShown

expression Required. An expression that returns an Application object.

Example

The following example prompts the user to enter the number of months he or she wants to view in the report, and then sets the MonthsShown property to that value. The subroutine "SetMonths" prompts the user for input, performs a validation on the input data, converts it to the correct type and sets the MonthsShown property to the new value. If the value is of an incorrect type, an error message is displayed to the user.

Sub SetMonthsShow()
'Modifies the MonthsShown property

   Dim objApp As FrontPage.Application
   Set objApp = FrontPage.Application
   Call SetMonths(objApp)

End Sub

Sub SetMonths(ByRef objApp As Application)
'Sets the number of months to view in Reports view

    Dim varNum As Variant
    Dim lngNum As Long
    'Prompt the user to enter a value
    varNum = InputBox("Enter the number of months you wish to view in the report")
    'Check to see that the value is of the correct type
    If IsNumeric(varNum) Then
       'If it's numeric, convert it to Long
       lngNum = CLng(varNum)
       'Set the MonthsShown value to the new value
       objApp.MonthsShown = lngNum
       'Display the new setting information to the user
       MsgBox "The MonthsShown value was set correctly." &
               _  " The number of months that will be shown is " _
               & lngNum & "."
    Else
       'Otherwise, display an error message to the user
       MsgBox "The input value was incorrect", vbCritical
    End If

End Sub


mseMode Property

Returns a Boolean that indicates if the current document is in MSE mode. MSE mode corresponds to the Microsoft Script Editor. If True, the document is in MSE mode. If False, the document is not in MSE Mode. Read-only.

expression.mseMode

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays a message to the user indicating if the document is in MSE mode.

Sub DisplayMsemode()
'Displays the MSE mode of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display msemode
    If objDoc.mseMode = False Then
        MsgBox "The current document is not in MSE mode."
    Else
        MsgBox "The current document is in MSE mode."
    End If
End Sub


Name Property

Returns the string value of the name assigned to the specified object. Read-only String.

Remarks

The name of a file or folder is usually the last part of the URL. For example, is you have a URL such as, "C:\My Webs\Adventure Works\index.htm", the Name object of the file is "index.htm". Similarly, "Images" is the Name object for the folder of the URL, "C:\My Webs\Adventure Works\Images".

Example

The following statement returns the application name with AppName as the string variable.

AppName = Application.Name


nameProp Property

Returns a String that represents the name of the current document. Read-only.

expression.nameProp

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example uses the nameProp property to display the name of the document along with the date that the document was last modified.

Sub GetLastModifiedDate()
'Returns the last modification date of the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display name of file and date last modified.
    MsgBox "The file " & objDoc.nameProp & " was last modified on " & _
            objDoc.lastModified & "."

End Sub


NavigationNode Property

Returns the current NavigationNode object in the navigation structure for the WebFile object.

Remarks

If a NavigationNode is not found within the current FrontPage-based web navigation structure, the NavigationNode property returns Null.

Example

This example uses the NavigationNode property to return the file name associated with the navigation node.

Private Sub GetNavNode()
    Dim myWeb As WebEx
    Dim myNavNode As NavigationNode
    Dim myNavNodeLabel As String

    Set myWeb = ActiveWeb
    Set myNavNode = _
            myWeb.RootNavigationNode.Files(0).NavigationNode

    With myNavNode
            myNavNodeLabel = .Label
    End With
End Sub


NewForm Property

Returns or sets a String that represents the form used for adding new content to the current list in Microsoft FrontPage. Read/write.

expression.NewForm

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The default file name for the BasicList and Survey objects is NewForm.htm. The default filename for the DocumentLibrary is Upload.htm.

Example

The following example displays the name of each list in the active web and the relative URLs of their associated New form pages. If the active web contains no lists, a message is displayed to the user.

Sub ViewNewFormURL()
'Display the URL of the form
'associated with adding new content

    Dim lstWebList As List
    Dim strURL As String

    If Not ActiveWeb.Lists Is Nothing Then
        'Cycle through lists and add URLs to string
        For Each lstWebList In ActiveWeb.Lists
            If strURL = "" Then
                strURL = lstWebList.Name & "  -  " & _
                lstWebList.NewForm & vbCr
            Else
                strURL = strURL & lstWebList.Name & "  -  " & _
                lstWebList.NewForm & vbCr
            End If
        Next
        'Display URLs of all New forms in web
        MsgBox "The relative URLs of the New forms are:" _
               & vbCr & vbCr & strURL
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If

End Sub


NewPageorWeb Property

Returns a NewFile object.

expression.NewPageorWeb

expression Required. An expression that returns an Application object.

Example

The following example creates a reference to an instance of the StartWorking object.

Sub NewPage()
'Creates a new page using the StartWorking object

   Dim objApp As FrontPage.Application
   Dim objStrtWrk As StartWorking
   Set objApp = FrontPage.Application
   'Create a reference to an instance of the StartWorking object
   Set objStrtWrk = objApp.NewPageorWeb

End Sub


Next Property

Returns the next navigation node in the navigation sequence. Read-only Object.

Remarks

Although the Next property is a member of the NavigationNode class, this property navigates within the Children collection of the specified NavigationNode object.

Note The Children collection does not wrap, so that code such as Children(Children.Count – 1).Next returns an "Object or With variable not set" error.

Example

This example moves the navigation pointer to the next node, unless the current node is the last node of the level in the navigation structure.

Private Sub MoveNext()
    Dim theNode As NavigationNode
    Dim theNextNode As NavigationNode
    On Error Resume Next

    Set theNode = ActiveWeb.HomeNavigationNode.Children(1)
    Set theNextNode = theNode.Next

    If Err <> 0 then
            MsgBox “End of the current navigation row”
    End If
End Sub


NumberOfLines Property

Returns or sets a Long that represents the number of lines that will appear in the field. Read/write.

expression.NumberOfLines

expression Required. An expression that returns a ListFieldMultiLine object.

Example

The following example adds a new field named Description of type ListFieldMultiLine to the ListFields collection. The subroutine displays the name of the new field as well as the number of lines it will contain.

Sub CreateMultiLine()
'Add new MultiLine Field
    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim ObjField As ListField
    Dim objLstFldMulti As ListFieldMultiLine
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "Description"
    'Add new Field of type fpFieldMultiLine to list
    objLstFlds.Add Name:=strName, Description:="Description Field", _
                   Fieldtype:=fpFieldMultiLine
    Set objLstFldMulti = objLstFlds.Item(strName)
    objLstFldMulti.NumberofLines = 5
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & ". It contains " & _
           objLstFldMulti.NumberOfLines & " lines."

End Sub


OlderFile Property

Returns or sets a Long that determines the number of days that a file must exist in a web (without being modified) before it is classified as older. Once a file is classified as older, it appears in the Older Files view in the Microsoft FrontPage Reports view. Read/write.

expression.OlderFile

expression Required. An expression that returns an Application object.

Example

The following example prompts the user to enter a value that specifies the number of days a file must exist before it is classified as older. The subroutine SetOldVal prompts the user for input, performs a validation on the input data, converts it to the correct type and sets the OlderFile property to the new value. If the value is of an incorrect type, an error message is displayed to the user.

Sub FPOldFile()
'Sets a value that determines how old a file is

   Dim objApp As FrontPage.Application
   Set objApp = FrontPage.Application
   Call SetOldVal(objApp)

End Sub

Sub SetOldVal(ByRef objApp As Application)
'Sets the value that determines how old a file is

    Dim varNum As Variant
    Dim lngNum As Long
    'Prompt the user to enter a value
    varNum = InputBox("Enter the number of days a file can exist " &
                      _ "before it is classified as old.")
    'Check to see that the value is of the correct type
    If IsNumeric(varNum) Then
       'If it's numeric, convert it to Long
       lngNum = CLng(varNum)
       'Set the OlderFIle value to the new value
       objApp.OlderFile = lngNum
       'Display the new setting information to the user
       MsgBox "The OlderFile value was set correctly." & vbCr & _
              "The number of days after which a file becomes old is " _ & lngNum & "."
    Else
       'Otherwise, display an error message to the user
       MsgBox "The input value was incorrect.", vbCritical
    End If

End Sub


onafterupdate Property

Returns or sets a Variant that represents the value of the onafterupdate event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read\write.

expression.onafterupdate

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message after the current page is updated.

<head>
<title>onafterupdate Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed after the current page is updated."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user updates the current page, a message will be displayed.

<body>
<p onafterupdate = "DisplayMessage"></p>
</body>

The following line of code sets the onafterupdate attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onafterupdate = "Display Message"


onbeforeupdate Property

Returns or sets a Variant that represents the value of the onbeforeupdate event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read\write.

expression.onbeforeupdate

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user before the current page is updated.

<head>
<title>onbeforeupdate Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user updates the document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the document is updated, a message will be displayed.

<body>
<p onbeforeupdate = "DisplayMessage"></p>
</body>

The following line of code sets the onbeforeupdate attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onbeforeupdate = "Display Message"


onclick Property

Returns or sets a Variant that represents the value associated with the onclick event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onclick

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user clicks a <p> element containing the onclick="DisplayMessage" attribute in the current page.

<head>
<title>onclick Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user clicks the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user clicks the <p> element in the document, a message will be displayed.

<body>
<p onclick = "DisplayMessage">Click this paragraph to view a message.</p>
</body>

The following line of code sets the onclick attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onclick = "Display Message"


ondblclick Property

Returns or sets a Variant that represents the value associated with the ondblclick event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.ondblclick

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user double-clicks a <p> element containing the ondblclick="DisplayMessage" attribute in the current page.

<head>
<title>ondblclick Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user double-clicks the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user clicks the <p> element in the document, a message will be displayed.

<body>
<p ondblclick = "DisplayMessage">Double-click this paragraph to view a message.</p>
</body>

The following line of code sets the ondblclick attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).ondblclick = "Display Message"


ondragstart Property

Returns or sets a Variant that represents the value associated with the ondragstart event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.ondragstart

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user drags a selection from the current <p> element containing the ondragstart="DisplayMessage" attribute in the current page.

<head>
<title>ondragstart Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user drags a selection within the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user drags a selection from within the <p> element in the document, a message will be displayed.

<body>
<p ondragstart = "DisplayMessage">Select this text and drag it to view a message.</p>
</body>

The following line of code sets the ondragstart attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the first <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).ondragstart = "Display Message"


onhelp Property

Returns or sets a Variant that represents the value associated with the onhelp event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onhelp

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the help file is launched.

<head>
<title>onhelp change Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the help file is launched."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the help file is launched a message will be displayed.

<body>
<p onhelp = "DisplayMessage"></p>
</body>


onkeydown Property

Returns or sets a Variant that represents the value associated with the onkeydown event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onkeydown

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user presses a key down within the current <form> element containing the onkeydown="DisplayMessage" attribute in the current page.

<head>
<title>onkeydown Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user presses a key down within the <form> element in the current document."

End Sub

-->
</script>
</head>

The <form> section code below calls the DisplayMessage procedure located in the < head> section of the document. When the user presses a key down within the <form> element in the document, a message will be displayed.

<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV"
   S-Label-Fields="TRUE" --><p onkeydown="DisplayMessage">
  <input type="text" name="T1" size="20"><input type="submit" value="Submit"
   name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

The following line of code sets the onkeydown attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <form> tag as the first <form> element in the current page and the first <form> element in the all collection.

ActiveDocument.body.all.tags("form").item(0).onkeydown = "Display Message"


onkeypress Property

Returns or sets a Variant that represents the value associated with the onkeypress event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onkeypress

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user presses a key within the current <form> element containing the onkeypress="DisplayMessage" attribute in the current page.

<head>
<title>onkeypress Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user presses a key within the <form> element in the current document."

End Sub

-->
</script>
</head>

The <form> section code below calls the DisplayMessage procedure located in the < head> section of the document. When the user presses a key within the <form> element in the document, a message will be displayed.

<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV"
   S-Label-Fields="TRUE" --><p onkeypress="DisplayMessage">
  <input type="text" name="T1" size="20"><input type="submit" value="Submit"
   name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

The following line of code sets the onkeypress attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <form> tag as the first <form> element in the current page and the first <form> element in the all collection.

ActiveDocument.body.all.tags("form").item(0).onkeypress = "Display Message"


onkeyup Property

Returns or sets a Variant that represents the value associated with the onkeyup event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onkeyup

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user presses and releases a key within the current <form> element containing the onkeyup="DisplayMessage" attribute in the current page.

<head>
<title>onkeyup Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user releases a key within the <form> element in the current document."

End Sub

-->
</script>
</head>

The <form> section code below calls the DisplayMessage procedure located in the < head> section of the document. When the user releases a key within the <form> element in the document, a message will be displayed.

<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV"
   S-Label-Fields="TRUE" --><p onkeyup="DisplayMessage">
  <input type="text" name="T1" size="20"><input type="submit" value="Submit"
   name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

The following line of code sets the onkeyup attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <form> tag as the first <form> element in the current page and the first <form> element in the all collection.

ActiveDocument.body.all.tags("form").item(0).onkeyup = "Display Message"


onmousedown Property

Returns or sets a Variant that represents the value associated with the onmousedown event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onmousedown

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user depresses a mouse button over a <p> element containing the onmousedown="DisplayMessage" attribute in the current page.

<head>
<title>onmousedown Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user depresses a mouse button over the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user depresses a mouse button within the <p> element in the document, a message will be displayed.

<body>
<p onmousedown = "DisplayMessage">Move the mouse over this paragraph and depress a button to view a message.</p>
</body>

The following line of code sets the onmousedown attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onmousedown = "Display Message"


onmousemove Property

Returns or sets a Variant that represents the value associated with the onmousemove event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onmousemove

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user moves the mouse over a <p> element containing the onmousemove="DisplayMessage" attribute in the current page.

<head>
<title>onmousemove Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user moves the mouse over the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user moves the mouse over the <p> element in the document, a message will be displayed.

<body>
<p onmousemove = "DisplayMessage">Move the mouse over this paragraph to view a message.</p>
</body>

The following line of code sets the onmousemove attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onmousemove = "Display Message"


onmouseout Property

Returns or sets a Variant that represents the value associated with the onmouseout event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onmouseout

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user moves the mouse out of the <p> element containing the onmouseout="DisplayMessage" attribute in the current page.

<head>
<title>onmouseout Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user moves the mouse out of the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user moves the mouse out of the <p> element in the document, a message will be displayed.

<body>
<p onmouseout = "DisplayMessage">Move the mouse out of this paragraph to view a message.</p>
</body>

The following line of code sets the onmouseout attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onmouseout = "Display Message"


onmouseover Property

Returns or sets a Variant that represents the value of the onmouseover event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred.

expression.onmouseover

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user positions the mouse over a <p> element containing the onmouseover="DisplayMessage" attribute in the current page.

<head>
<title>onmouseover Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user positions the mouse over the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user positions the mouse over the <p> element in the document, a message will be displayed.

<body>
<p onmouseover = "DisplayMessage">Move the mouse over this paragraph to view a message.</p>
</body>

The following line of code sets the onmouseover attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onmouseover = "Display Message"


onmouseup Property

Returns or sets a Variant that represents the value associated with the onmouseup event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onmouseup

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user releases the mouse button within the <p> element containing the onmouseup="DisplayMessage" attribute in the current page.

<head>
<title>onmouseup Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user releases the mouse button within the <p> element section in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user releases the mouse button within the <p> element in the document, a message will be displayed.

<body>
<p onmouseup = "DisplayMessage">Move the mouse over this sentence, depress a button and release it to view a message.</p>
</body>

The following line of code sets the onmouseup attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the only <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onmouseup = "Display Message"


onreadystatechange Property

Returns or sets a Variant that represents the value associated with the onreadystatechange event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onreadystatechange

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the ready state of the current document changes.

<head>
<title>onreadystate change Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the ready state of the current document changes."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the ready state of the current document changes a message will be displayed.

<body>
<p onreadystatechange = "DisplayMessage"></p>
</body>


onselectstart Property

Returns or sets a Variant that represents the value associated with the onselectstart event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.

expression.onselectstart

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user selects text from within the current <p> element containing the onselectstart="DisplayMessage" attribute in the current page.

<head>
<title>onselectstart Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--

Sub DisplayMessage
'Displays message to user

    MsgBox "This message is displayed when the user selects text from within the <p> element in the current document."

End Sub

-->
</script>
</head>

The <p> section code below calls the DisplayMessage procedure located in the <head> section of the document. When the user selects text from within the <p> element in the document, a message will be displayed.

<body>
<p onselectstart = "DisplayMessage">Select this text to view a message.</p>
</body>

The following line of code sets the onselectstart attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <p> tag as the only <p> element in the current page and the first <p> element in the all collection.

ActiveDocument.body.all.tags("p").item(0).onselectstart = "Display Message"


OperatingSystem Property

Returns the name of the current operating system, for example, “Windows” or “Windows NT”. Read-only String.

Example

The following example displays system information in a label on a form.

lblSystemInfo.Caption = System.OperatingSystem

This example prints the name of the current operating system in the Immediate window.

myOpSys = System.OperatingSystem


OrganizationName Property

Returns the name of the orgranization for the application. Read-only String.

Note The name of the organization is usually set during the installation of an application or operating system.

Example

Instead of creating a company name variable for your Web page, you can use the organization name as shown in the following statement.

myCompanyName = Application.OrganizationName


pageContentElement Property

Returns an IHTMLElement object that represents the page content of the current document.

expression.pageContentElement

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example creates a reference to the IHTMLElement object and displays its corresponding HTML tag name.

Sub PageContent()
'Returns the tag name of the page content element

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objContent As IHTMLElement

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument

    Set objContent = objDoc.pageContentElement
    'Display message to user.
    MsgBox "The tag name of the current page element is: " _
           & objContent.tagName & "."

End Sub


PageWindows Property

Returns the specified PageWindowEx object.

expression.PageWindows

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example retrieves a page window that contains the page Spain.htm and sets the view mode to Preview.

Note To run this procedure, you must have an open web that contains an open page called Spain.htm, or substitute a file of your choice.

Private Sub SetPagePreview()
    Dim myPage As PageWindowEx

    Set myPage = ActiveWebWindow.PageWindows("Spain.htm")
    myPage.ViewMode = fpPageViewPreview
End Sub


Parent Property

Returns the name of the Parent object for the specified object.

expression.Parent

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

Specifying the Parent property of a WebFile object returns the WebFolder object. When an object is contained in a web, the Parent property returns the WebEx object. For example, if the Theme object is contained in a WebEx object called "Adventure Works Web", the Parent property returns "Adventure Works Web"; otherwise, for a theme referenced outside of a WebEx object, the Parent property returns the name of the Application object—in this case, "Microsoft FrontPage". However, when the System object is specified from a client computer, the Parent property returns the Application object of the host, not the client.

The following table describes the values returned for the different object types.

Object | Description
MetaTags | Returns the WebFile object for the META tags.
NavigationNode | Returns the parent NavigationNode object, except in the case of the RootNavigationNode object, whose parent is the WebEx.
NavigationNodes | Returns the parent NavigationNode object for the collection of navigation nodes based on the navigation structure.
PageWindowEx | Returns the WebWindowEx or Application object in which the page resides.
PageWindows | Returns the Application object that contains the collection.
Properties | Returns the WebEx, WebFile or WebFolder object from the META tag information.
System | Returns the Application object.
Theme | Returns the parent WebEx or WebFile object for the theme.
Themes | Returns the WebEx object that contains the collection.
WebEx | Returns the Application object.
WebFile | Returns the WebFolder object.
WebFiles | Returns the parent WebFolder object.
WebFolder | Returns either the parent WebFolder object (if it's a subfolder) or returns the WebEx object for the root folder.
WebFolders | Returns the WebFolder object that contains the collection.
Webs | Returns the Application object.
WebWindowEx | Returns the Application object that contains the specified object.
WebWindows | Returns the Application object that contains the collection.

Example

In this example, myParent returns the file type and build of the parent application for the active FrontPage-based web.

Private Sub GetParentInfo()
    Dim myWeb As WebEx
    Dim myParent As String
    Dim myParentBuild As String

    Set myWeb = Application.ActiveWeb

    With myWeb
        myParent = .Parent.FileSearch.FileType
        myParentBuild = .Parent.Build
    End With
End Sub


parentWindow Property

Returns an FPHTMLWindow2 object that represents the parent window of the current document.

expression.parentWindow

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the name of the current document's parent window if it exists. If the name property is not specified, a message is displayed to the user.

Sub ReturnParent()
'Returns the parent window of the active document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim wdwParent As FPHTMLWindow2

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Create reference to active document's parent window
    Set wdwParent = objDoc.parentWindow
    'If parent's name exists
    If Not wdwParent.Name = "" Then
        'Display names to user
        MsgBox objDoc.nameProp & "'s parent window is " _
                               & wdwParent.Name & "."
    Else
        'Display message to user
        MsgBox objDoc.nameProp &  _
               "'s parent window does not have a name or does not exist."
    End If

End Sub


Prev Property

Returns the previous navigation node in the navigation sequence. Read-only.

Example

This example moves the navigation pointer to the previous node, unless the current node is the first node of the level in the navigation structure.

Private Sub MovePrev()
    Dim theNode as NavigationNode
    Dim thePrevNode as NavigationNode
    On Error Resume Next

    Set theNode = ActiveWeb.HomeNavigationNode.Children(1)
    Set thePrevNode = theNode.Prev

    If Err <> 0 Then
            MsgBox “The current navigation level starts here.”
    End If
End Sub


PreviewDocument Property

Returns an IHTMLDocument2 object that represents the document in the preview window. Read-only.

expression.PreviewDocument

expression Required. An expression that returns a PageWindowEx object.

Remarks

The PreviewDocument property returns nothing if the active page window is not currently in preview mode.

Example

The following example displays the title of the document currently in preview mode. If there is no document in preview mode, a message is displayed to the user.

Sub PreviewDocument()
'Displays the title of the document currently in preview mode

    Dim FPApp As FrontPage.Application
    Dim objPageWindow As PageWindowEx

    Set FPApp = FrontPage.Application
    Set objPageWindow = FPApp.ActivePageWindow
    'If the page window is in preview mode, display the title
    If objPageWindow.ViewMode = fpPageViewPreview Then
        MsgBox "The title of the document is: " _
               & objPageWindow.PreviewDocument.Title
    Else
        MsgBox "The page window is not in preview mode."
    End If

End Sub


ProductCode Property

Returns the globally unique identifier (GUID) for Microsoft FrontPage. Read-only String.

Example

This statement returns the Product ID for FrontPage.

mySystem = Application.ProductCode


ProfileString Property

Returns or sets a String value for an entry in the Microsoft Windows registry under the following subkey:

HKEY_CURRENT_USER\Software\Microsoft\FrontPage\

expression.ProfileString(RegistrySection, RegistryKey)

expression Required. An expression that returns a System object.

RegistrySection Required String. A subkey below the "HKEY_CURRENT_USER\Software\Microsoft\FrontPage\" subkey in the Windows registry.

RegistryKey Required String. The name of the entry in the subkey specified by szSection. For example, Software or Network in the Registry Editor are subkeys.

Example

This example returns the value of the subkey, 0 (zero), in the Recently Used URLs entry.

Note To run this example, you must have recently opened a page that exists in one of your webs.

Private Sub GetRegRecentlyUsedInfo()
    Dim mySecKey As String
    Dim myRegKey As String
    Dim myProfile As String

    mySecKey = "HKEY_CURRENT_USER\Software"
    mySecKey = mySecKey & _
            "\Microsoft\FrontPage\Editor\Recently Used URLs"
    myRegKey = "0"

    myProfile = System.ProfileString(mySecKey, myRegKey)
End Sub


Properties Property

Returns the Properties collection for the specified object.

Example

This example adds a new property and displays it on the active web page.

Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT), and a file called "Zinfandel.htm". Or, you may substitute an alternative web URL or file.

Private Sub CopyrightAdd()
    Dim myWeb As WebEx
    Dim myCopyright As String

    myCopyright = "Copyright 1999 by Rogue Cellars"
    Set myWeb = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
    myWeb.Activate
    ActiveWeb.Properties.Add "Copyright", myCopyright
    ActiveWeb.RootFolder.Files("Zinfandel.htm").Open
    ActiveDocument.body.insertAdjacentText "BeforeEnd", _
            ActiveWeb.Properties("Copyright")
    ActivePageWindow.Save
    ActiveWeb.Close
End Sub


protocol Property

Returns a String that represents the protocol of the current document. The protocol property returns the protocol substring up to and including the first colon, which indicates the URL's access method. Read-only.

expression.protocol

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example displays the protocol type used to access the active document.

Sub ProtocolType()
'Returns the protocol type used by the active document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display protocol type
    MsgBox "The current document's protocol type is :" & objDoc.protocol

End Sub


ReadOnly Property

Returns a Boolean that determines if the current field has read-only permissions. If True, the field cannot be modified by the user. Read-only.

expression.ReadOnly

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example stores the names and default values of all fields with read-only permissions in the first list of the active web. If the active web contains no lists, a message is displayed to the user.

Sub FieldPermissions()
'Displays read/write permissions of all
'fields in the list.

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim objFields As listFields
    Dim strPerms As String

    Set objApp = FrontPage.Application
    Set objFields = objApp.ActiveWeb.Lists.Item(0).Fields

    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objFields
             'If field is read-only, add to list
             If objField.ReadOnly = True Then
                If strPerms = "" Then
                    'if first value in string
                    strPerms = objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                Else
                    'add value to string
                    strType = strPerms & objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                End If
             End If
        Next objField
    Else
        'display message to user
        MsgBox "The active web contains no lists."
    End If
End Sub


ReadSecurity Property

Returns or sets an FpListReadSecurity constant that determines which users can read the information in the list. Read/write.

FpListReadSecurity can be one of these FpListReadSecurity constants.
fpListReadSecurityAll All users can read the list.
fpListReadSecurityOnlyOwn Only the creator of the list can read it.

expression.ReadSecurity

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example changes the read permissions of all lists of type fpListBasicList in the active web to fpListReadSecurityAll. All users can now read all lists of type fpListTypeBasicList.

Note Use the ApplyChanges method to save any changes to the list.

Sub ChangePermissions()
'Changes permission of all BasicLists in the current web

    Dim objApp As FrontPage.Application
    Dim objList As Object
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists

    'Cycle through each list and check for list type
    For Each objList In objLists
        'If it's a BasicList then change permissions
        If objList.Type = fpListTypeBasicList Then
            If objList.ReadSecurity <> fpListReadSecurityAll Then
                objList.ReadSecurity = fpListReadSecurityAll
            objList.ApplyChanges
            End If
        End If
    Next

End Sub


readyState Property

Returns a String that represents the ready state of the active document. The readyState property determines the current state of a file being downloaded. Read-only.

expression.readyState

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The readyState property value can be one of the following values:

uninitialized | The object is not initialized with data.
loading | The object is currently loading its data.
interactive | The object can be interacted with even though it is not fully loaded.
complete | The control is completely loaded.

Example

The following example displays the current ready state of the active document.

Sub DisplayreadyState()
'Displays the ReadyState for the current document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Display ready state of current document
    MsgBox "The ready state of the active document is: " & objDoc.readyState & "."

End Sub


RecentFile Property

Returns or sets a Long that determines the number of days that a file can exist in a web (without being modified) before it appears as older in the Microsoft FrontPage reports view. For example, if the RecentFile property is set to 20, a new file or a file that has been modified will be classified as recent for the first 20 days of its existence. Files that are classified as recent appear in the Recently Added files view in the Reports view. Read/write.

expression.RecentFile

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example prompts the user to enter the number of days a file can exist with the classification recent, and then sets the RecentFile property to that value. The subroutine SetRecent prompts the user for input, performs a validation on the input data, converts it to the correct type and sets the RecentFile property to the new value. If the value is of an incorrect type, an error message is displayed to the user.

Sub FPRecentFile()
'Sets a value that determines how long a file can be classified recent

   Dim objApp As FrontPage.Application
   Set objApp = FrontPage.Application
   Call SetRecent(objApp)

End Sub

Sub SetRecent(ByRef objApp As Application)
'Sets the value that determines how long a file will be classified as recent
    Dim varNum As Variant
    Dim lngNum As Long
    'Prompt the user to enter a value
    varNum = InputBox("Enter the number of days a file " & _
                      "can exist before it is classified as old.")
    'Check to see that the value is of the correct type
    If IsNumeric(varNum) Then
       'If it's numeric, convert it to Long
       lngNum = CLng(varNum)
       'Set the OlderFIle value to the new value
       objApp.RecentFile = lngNum
       'Display the new setting information to the user
       MsgBox "The RecentFile value was set correctly." & vbCr & _
              "The number of days a new or modified file will be classified as recent is " _
               & lngNum & "."
    Else
       'Otherwise, display an error message to the user
       MsgBox "The input value was incorrect.", vbCritical
    End If

End Sub


Required Property

Returns or sets a Boolean that determines if the field is required. If the field is required, it cannot be removed from the current list. Read/write.

expression.Required

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example displays the names and default values of all required fields in the current list. If no required fields exist or if the active web contains no lists, a message is displayed to the user.

Sub DisplayRequiredFields()
'Displays the names and default values
'of all required fields in the first list of
'the web.

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim objFields As ListFields
    Dim strReq As String
    Dim BlnFound As Boolean

    Set objApp = FrontPage.Application
    Set objFields = objApp.ActiveWeb.Lists.Item(0).Fields
    'set found flag to false
    BlnFound = False
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objFields
             'If field is required, add to list
            If objField.Required = True Then
                If strReq = "" Then
                    'if first value in string
                    strReq = objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                    'The list contains at least 1 required field
                    BlnFound = True
                Else
                    'add value to string
                    strReq = strReq & objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                End If
            End If
        Next objField

    Else
        'display message to user
        MsgBox "The active web contains no lists."
    End If
    If BlnFound = True Then
        MsgBox "The current list contains the following required fields: " & _
               vbCr & strReq
    Else
        MsgBox "The current list contains no required field(s)."
    End If
End Sub


RevisionControlProject Property

Returns or sets the RevisionControlProject property. Read/write String.

Remarks

A revision control project can either be a Visual SourceSafe project, or a FrontPage-based locking project. For a Visual SourceSafe control project, you must start your project with the string "$/"; for a FrontPage-based locking control project, you must set the RevisionControlProject property to "<FrontPage-based Locking>".

To remove a source control project, use the following statement to set the revision control project to an empty string.

Set RevisionControlProject = ""

Example

This example sets the RevisionControlProject property in a Microsoft Visual SourceSafe project.

Private Sub SetRevisionControlProjectName()
    Dim myWeb As WebEx
    Dim myRevisionControlProject As String

    Set myWeb = ActiveWeb
    myRevisionControlProject = _
            "$/Rogue Cellars/Rogue Cellars Update"

    myWeb.RevisionControlProject = _
            myRevisionControlProject
End Sub


RootFolder Property

Returns a WebFolder object that represents the active WebEx object's root.

Example

The following statement returns the name of the root folder.

ActiveWeb.RootFolder.Name


RootNavigationNode Property

Returns a NavigationNode object that represents the abstract navigation root.

Remarks

You can use the RootNavigationNode property to determine the root navigation node. The RootNavigationNode property returns the NavigationNode object from which you can access all other navigation nodes in a web. The RootNavigationNode object is created by default when you create a web and provides the basis for the navigation structure, which is accessed through the Children collection. The first child node of the navigation structure is the home page of the Web site.

Example

The following example adds a global navigation node to the right of the home navigation node.

Private Sub AddNode()
    Dim myRNode As NavigationNode
    Dim myPage As String

    Set myRNode = ActiveWeb.RootNavigationNode
    myPage = "http://myServer/myWeb/search.htm"

    Call myRNode.Children.Add(myPage, "Search", _
            fpStructRightmostChild)
    ActiveWeb.ApplyNavigationStructure
End Sub


scripts Property

Returns an IHTMLElementCollection collection object that represents the collection of all <SCRIPT> elements in the current document.

expression.scripts

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example creates a reference to the current document's scripts collection and displays the title (if it exists) for each script in the collection.

Sub ReturnScripts()
'Returns a collection of all scripts in the document

    Dim objApp As FrontPage.Application
    Dim objScripts As IHTMLElementCollection
    Dim objScript As IHTMLElement

    Set objApp = FrontPage.Application
    Set objScripts = objApp.ActiveDocument.scripts
    'For each script in the document
    For Each objScript In objScripts
        'if it has a title, display it
        If Not objScript.Title = "" Then
            MsgBox objScript.Title
        End If
    Next objScript

End Sub


SelectedFiles Property

Returns an array of WebFile objects representing the selected files.

expression.SelectedFiles

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

You must have the Folders view open in the User Interface (UI) in order to select multiple files and you must use the right pane to select the files. From Folders view you can select multiple files in a single web or in multiple webs. If you must use Page view, you can only select one file per web from the left pane.

Tip You can use the fpWebViewFolders constant of the ViewMode property to set the view to the Folders view.

Example

This example concatenates the names of the selected files.

Note The delimiter used to separate the file names in the variable mySelName is a space.

Private Sub GetSelectedFileNames()
    Dim myWebWindows As WebWindows
    Dim myWebWindow As WebWindowEx
    Dim mySelFiles As Variant
    Dim mySelFile As WebFile
    Dim mySelName As String
    Dim myCount As Integer

    Set myWebWindows = WebWindows

    mySelFiles = ActiveWebWindow.SelectedFiles

    For myCount = 0 To UBound(mySelFiles)
            Set mySelFile = mySelFiles(myCount)
            mySelName = mySelName & " " & mySelFile.Name
    Next
End Sub


SelectedFolders Property

Returns an array of WebFolder objects representing the selected folders.

expression.SelectedFolders

expression Required. An expression that returns a WebWindowEx object.

Remarks

You must have the Folders view open in the User Interface (UI) in order to select multiple folders and you must use the right pane to select the folders. From Folders view, you can select multiple folders in a single web or in multiple webs. If you must use Page view, you can only select one folder per web from the folders in the left pane.

Note If you're programmatically selecting folders, you can use the fpWebViewFolders constant of the ViewMode property to set the view to the Folders view.

Example

This example concatenates the names of the selected folders.

Note The delimiter used to separate the folder names in the variable mySelName is a space.

Private Sub GetSelectedFolderNames()
    Dim myWebWindows As WebWindows
    Dim myWebWindow As WebWindowEx
    Dim mySelFolders As Variant
    Dim mySelFolder As WebFolder
    Dim mySelName As String
    Dim myCount As Integer

    Set myWebWindows = WebWindows

    mySelFolders = ActiveWebwindow.SelectedFolders

    For myCount = 0 To UBound(mySelFolders)
        Set mySelFolder = mySelFolders(myCount)
        mySelName = mySelName & " " & mySelFolder.Name
    Next
End Sub


selection Property

Returns an IHTMLSelectionObject object that represents the current user selection. The IHTMLSelectionObject object contains methods, such as the clear method, that allows you to clear the selected items.

expression.selection

expression Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the current user selection and stores it in a variable called objSelection. If the selection is type Text, it is deleted using the clear method. If the selection is not text, the selection is emptied using the empty method.

Sub Selection()
'Returns a selection and clears it if is type text

    Dim objApp As FrontPage.Application
    Dim objSelection As IHTMLSelectionObject

    Set objApp = FrontPage.Application
    Set objSelection = objApp.ActiveDocument.Selection
    'Clear the selected area of text
    If objSelection.Type = "Text" Then
       objSelection.Clear
    Else
       'Otherwise empty selection
       objSelection.empty
    End If
End Sub


SharedBorders Property

True if any shared borders are in use for the WebEx or WebFile object. Read/write Variant.

expression.SharedBorders(BorderIndex)

expression Required. An expression that returns a WebEx or WebFile object.

BorderIndex Optional FpSharedBorders. The border index is an enumerated type and can be one of the constants in the following table. The default constant is fpBorderTop.

FpSharedBorders | Value | Description
fpBorderTop | 1 | Sets or returns a border for the top of a page.
fpBorderLeft | 2 | Sets or returns a border for the left side of a page.
fpBorderRight | 4 | Sets or returns a border for the right side of a page.
fpBorderBottom | 8 | Sets or returns a border for the bottom of a page.
fpBorderAll | 255 or &HFF | Sets or returns borders on all sides of a page.

Remarks

Shared borders, such as the constant fpBorderLeft, can be used to set individual border values.

Note The default shared border is used if a shared border is not specified.

Example

This example sets the shared border for the active web.

Private Sub SetSharedBorders()
    Dim myPage As PageWindowEx

    ActiveWeb.SharedBorders(fpBorderLeft) = True

End Sub


ShowAsPercentage Property

Returns or sets a Boolean that determines if the value in the field will be displayed as a percentage. Read/write.

expression.ShowAsPercentage

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example sets the ShowAsPercentage property of all fields of type fpFieldNumber to True. The values in the fields will now appear as a percentage.

Note Use the ApplyChanges method to apply any changes made to the list.

Sub DisplayAsPercentage()
'Displays all fields of type fpFieldNumber as
'a percentage

    Dim objApp As FrontPage.Application
    Dim objLstFlds As ListFields
    Dim strName As String
    Dim objLstFld As Object

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    'Cycle through lists and displays as a percentage
    For Each objLstFld In objLstFlds
        If objLstFld.Type = fpFieldNumber Then
            objLstFld.ShowAsPercentage = True
        End If
    Next objLstFld
    objApp.ActiveWeb.Lists.Item(0).ApplyChanges

End Sub


ShowStartupDialog Property

Returns or sets a Boolean that determines if the New Page or Web task pane will be displayed when Microsoft FrontPage is started. Read/write.

expression.ShowStartupDialog

expression Required. An expression that returns an Application object.

Remarks

The ShowStartup property is global, meaning that any changes will not take affect until FrontPage is restarted.

Example

The following example sets the ShowStartupDialog property to True. The next time FrontPage is started, the New Page or Web task pane will appear.

Sub TaskPaneStartup()
'Modifes the Startup task pane property

    Dim objApp As FrontPage.Application
    Set objApp = FrontPage.Application

    With objApp
       'Set to True, the task pane will appear on startup
       .ShowStartupDialog = True
    End With

End Sub


ShowUserNamesInResults Property

Returns or sets a Boolean that determines if the names of users who have completed the survey will be visible. Read/write.

expression.ShowUserNamesInResults

expression Required. An expression that returns a Survey object.

Example

The following example sets the ShowUserNamesInResults property for each Survey object in the active web to True, displaying the names of all users who completed the survey.

Note Use the ApplyChanges method to save any changes made to the list.

Sub ChangePermissions()
'Changes permission of all BasicLists in the current web

    Dim objApp As FrontPage.Application
    Dim objList As Object
    Dim objLists As Lists

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists

    'Cycle through each list and check for list type
    For Each objList In objLists
        'If it's a Survey then change permissions
        If objList.Type = fpListTypeSurvey Then
            If objList.ShowUserNamesInResults <> True Then
                objList.ShowUserNamesInResults = True
                objList.ApplyChanges
            End If
        End If
    Next

End Sub


SlowPage Property

Returns or sets a Long that specifies the number of seconds a page can take to download before it is classified as slow. Pages that are classified as slow appear in the Slow Pages list in the Microsoft FrontPage Reports view. Read/write.

expression.SlowPage

expression Required. An expression that returns an Application object.

Remarks

The SlowPage property is used in conjunction with the ConnectionSpeed property to determine the simulated download time of a Web page.

Example

The following example sets the SlowPage property to 10 seconds, indicating that all pages that take over 10 seconds to download (in this case, using a 56K modem) will be classified as slow in the FrontPage Reports view.

Sub SetSlowPage()
'Modifies the SlowPage property

    Dim objApp As FrontPage.Application
    Set objApp = FrontPage.Application

    With objApp
        'Set value to 10, slow pages take at least 10 seconds
        .SlowPage = 10
        'Set user's connection speed to 56K modem
        .ConnectionSpeed = fpConnect56K
    End With

End Sub


styleSheets Property

Returns an FPHTMLStyleSheetsCollection collection that represents the collection of all style sheets in the current document.

expression.styleSheets

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

Imported style sheets are contained within a <STYLE> element and are available through the imports collection.

Example

The following example creates a reference to the current document's style sheets collection and displays the title (if it exists) for each stylesheet in the collection.

Sub ReturnStyleSheets()
'Returns a collection of a style sheets in the document

    Dim objApp As FrontPage.Application
    Dim objStyleSheets As FPHTMLStyleSheetsCollection
    Dim objStyleSheet As FPHTMLStyleSheet

    Set objApp = FrontPage.Application
    Set objStyleSheets = objApp.ActiveDocument.styleSheets
    'For each style sheet in the document
    For Each objStyleSheet In objStyleSheets
        'if it has a title, display it
        If objStyle.Title <> "" Then
            MsgBox objStyleSheet.Title
        End If
    Next objStyleSheet

End Sub


SubTree Property

Returns a NavigationNodes collection object that represents a collection of all the nodes in the subtree of the current navigation node. A subtree of a node is defined as all nodes which are adjacent to or attached to the parent node and appear below the parent node in the tree hierarchy.

expression.SubTree

expression Required. An expression that returns a NavigationNode object.

Example

The following example prompts the user to enter the name of a navigation node in the current web and returns the subtree for that particular node. If the node is found, its label property value is added to a String containing the names of all nodes in the parent node's subtree. The String stored in the variable strSubNodes is displayed to the user. If the node is not found in the web, a message is displayed to the user.

Sub DisplaySubTree()
'Returns the subtree of a given node

    Dim objApp As FrontPage.Application
    Dim objNavNode As NavigationNode
    Dim objNavNodes As NavigationNodes
    Dim objSubTree As NavigationNodes
    Dim objSubNode As NavigationNode
    Dim strAns As String      'User input
    Dim blnFound As Boolean   'Boolean found flag
    Dim intCount As Integer   'Integer counter
    Dim strSubNodes As String 'Names of all sub nodes

    blnFound = False
    intCount = 0
    Set objApp = FrontPage.Application
    'Create a reference to the NavigationNodes collection
    Set objNavNodes = objApp.ActiveWeb.AllNavigationNodes
    'Prompt the user to enter the name of the node
    strAns = InputBox("Enter the name of the node for which " & _
                       " you want to view the subtree.")
    'While the node is not found and there are more nodes in the tree
    Do While (Not blnFound = True) And (intCount <= objNavNodes.Count - 1)
        'Compare user input with node label
        If Trim(strAns) = objNavNodes.Item(intCount).Label Then
            'If found, return node
            Set objNavNode = objNavNodes.Item(intCount)
            'Set found flag to true
            blnFound = True
        Else
            'Otherwise increase counter, keep checking
            intCount = intCount + 1
        End If
    Loop
    If blnFound = True Then
       Set objSubTree = objNavNode.SubTree
       For Each objSubNode In objSubTree
           'If the string is empty or has not yet been set
           If strSubNodes = "" Then
               strSubNodes = strSubNodes & objSubNode.Label
           Else
               'otherwise add next node lable to string
               strSubNodes = strSubNodes & ", " & vbCr & objSubNode.Label
           End If
       Next objSubNode
       'Display names of all nodes in subtree
       MsgBox "The nodes found in the subtree of " & objNavNode.Label & " are: " _
              & vbCr & vbCr & strSubNodes & "."
    Else
       'If not found, display message to user
       MsgBox "The navigation node " & strAns & " was not found."

    End If
End Sub


SubViewMode Property

Returns or sets an FpWebSubView constant that determines the view type in the current subwindow. Read/write.

FpWebSubView can be one of these FpWebSubView constants.
fpWebSubViewFolders Change the current sub window view to Folders view.
fpWebSubViewNavigation Change the current sub window to Navigation view.
fpWebSubViewNone Close the current sub window.

expression.SubViewMode

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example prompts the user to open the sub window to the Folders view if the sub window is not currently visible. If the sub window is currently open, the user is not prompted and the program ends.

Sub SubModeType()
'Modifies the sub window view mode of the current web window

    Dim objApp As FrontPage.Application
    Dim objWebwdw As WebWindowEx
    Dim strAns As String

    Set objApp = FrontPage.Application
    Set objWebwdw = objApp.ActiveWebWindow
    'Check if the sub window is open or closed
    If objWebwdw.SubViewMode = fpWebSubViewNone Then
        strAns = MsgBox("The subwindow is not visible." & _
                        "Would you like to view the subwindow?", vbYesNo)
        'Prompt the user to open the subwindow
        If strAns = vbYes Then
            'Change the sub window to Folder view
            objWebwdw.SubViewMode = fpWebSubViewFolders
        End If
    End If

End Sub


System Property

Returns the System object.

Example

This statement returns the current operating system.

mySystem = Application.System.OperatingSystem


Template Property

Returns or sets a String that represents the file path of the template applied to the document library. Read/write.

expression.Template

expression Required. An expression that returns a DocumentLibrary object.

Example

The following example creates a reference to a document library named NewLibrary and displays the file path of the template associated with the library.

Sub TemplatePath()
'Displays the file path of the template

    Dim objApp As FrontPage.Application
    Dim objLists As Lists
    Dim objLibrary As DocumentLibrary

    Set objApp = FrontPage.Application
    Set objLists = objApp.ActiveWeb.Lists

    Set objLibrary = objLists.Item("NewLibrary")

    'Display message to user
    MsgBox "The file path of the template associated with the " & _
            "document library is " & objLibrary.Template & "."

End Sub


ThemeProperties Property

Returns the Theme object for the specified object.

expression.ThemeProperties(PropertyIndex)

expression An expression that returns a PageWindowEx, WebEx, or WebFile object.

PropertyIndex Optional FpThemeProperties. Returns or sets the theme properties. Can be one of the following FpThemeProperties constants shown in the table. For more detailed information on the individual Type constants shown in the following table, see the tables and lists in the ApplyTheme method.

FpThemeProperties | Value | Description
fpThemeActiveGraphics | 16 or &H10 | Sets or returns the active graphics constant.
fpThemeBackgroundImage | 1 | Sets or returns a background image.
fpThemeCSS | 4096 or &H1000 | Sets or returns the cascading style sheet.
fpThemeDefaultSettings | 16777216 or &H1000000 | Returns the theme applied to the web.
fpThemeName | 33554432 or &H2000000 | Sets or returns the ThemeName constant.
fpThemeNoBackgroundImage | 0 | Sets or returns a background without an image.
fpThemeNoCSS | 0 | Sets or returns this property if a cascading style sheet has not been set or is not wanted.
fpThemeNormalColors | 0 | Sets or returns the color mode for normal color.
fpThemeNormalGraphics | 0 | Sets or returns the graphics mode for normal graphics.
fpThemePropertiesAll | 4369 or &H1111 | Sets or returns all of the theme properties. After a theme is applied to an object, the fpThemePropertiesAll property combines all the properties applied to the object.
fpThemePropertiesNone | 0 | Sets or returns none for the theme properties.
fpThemeVivdColors | 256 | Sets or returns the vivid colors property.

Example

The following example checks the theme properties for active graphics. If active graphics have been applied, then vivid colors are applied in addition to the theme properties that are already applied to the active page window. If active graphics aren't applied, then active graphics and vivid colors are both applied to the active page window.

Private Sub GetThemeProperties()
    Dim myPageWindow As PageWindowEx

    Set myPageWindow = ActiveWeb.ActiveWebWindow.ActivePageWindow

    If myPageWindow.ThemeProperties(fpThemeActiveGraphics) Then
        myPageWindow.AppyTheme (fpThemePropertiesAll + _
            fpThemeVividColors)
        Exit Sub
    Else
        myPageWindow.ApplyTheme (fpThemePropertiesAll + _
            fpThemeActiveGraphics + fpThemeVividColors)
   End If
End Sub

The following example adds a background picture to the specified file.

Private Sub AddBackgroundImage()
    Dim myFile As WebFile

    Set myFile = Webs(0).Rootfolder.Files("index.htm")
    If myFile.ThemeProperties(fpThemeBackgroundImage) = 0 Then
        myFile.ApplyTheme myFile.ThemeProperties(fpThemeName), _
            myfile.ThemeProperties(fpThemePropertiesAll) + _
            fpThemeBackgroundImage
    End If
End Sub


Themes Property

Returns a collection of themes available for the specified object.

Remarks

The Themes property as applied to the Application object returns the collection of themes available to be applied. When the Themes property is applied to the WebEx object, it returns the collection of themes that have been applied to the web. This is the same as the list that appears in the web’s _theme directory. If a theme is applied to a WebEx object, there will be one theme in the collection. However, if a page in a web has its own theme, separate from the theme that was applied to the web, then the Themes collection for the WebEx object will have two themes in it — the theme that was originally applied to the web, and the theme that was applied specifically to the page.

Example

This example searches for a specific theme among the themes that are available locally on the client, as well as the themes applied to the ActiveWeb object.

Private Sub SearchAllThemes()
    Dim myTheme As Theme
    Dim myThemeToFind As String
    Dim myIsFound As Boolean

    myThemeToFind = “blends”
    myIsFound = False

    For Each myTheme In Application.Themes
            If myTheme.Label = myThemeToFind Then
                myIsFound = True
                Exit For
            End If
    Next

    For Each myTheme In ActiveWeb.Themes
            If myTheme.Label = myThemeToFind Then
                myIsFound = True
                Exit For
            End If
    Next

End Sub


Title Property

Returns the title of the specified object. Read-only or read/write String depending on the specified object.

Remarks

For the WebEx and WebFile objects the Title property returns the title of the active WebEx object as a read/write String.

Example

At the same time as you're traversing the navigation nodes, you can also return the title (file name) of the file that's associated with a particular node. The following example returns the title of the file associated with a navigation node in the active FrontPage-based web.

Private Sub GetFileFromNavNode()
    Dim myWeb As WebEx
    Dim myNavNode As NavigationNode
    Dim myFileFromNavNode As String

    Set myWeb = ActiveWeb
    Set myNavNode = _
            myWeb.RootNavigationNode.File.NavigationNode

    With myNavNode
            myFileFromNavNode = .File.Title
    End With
End Sub

The following example shows how you can set the title of the first file in the web.

Private Sub SetTitle()
    Dim myWeb As WebEx
    Dim myNewTitle As String
    Dim myFile As WebFile

    MyNewTitle = "Inventory.htm"
    Set myWeb = ActiveWeb
    Set myFile = myWeb.RootFolder.Files(0)

    MyFile.Title = myNewTitle
End Sub


Type Property

Type property as it applies to the BasicList, DocumentLibrary, List, and Survey objects.

Returns an FpListType constant that represents the type of the current list. Read-only.

FpListType can be one of these FpListType constants.
fpListTypeBasicList
fpListTypeDocumentLibrary
fpListTypeSurvey

expression.Type

expression Required. An expression that returns one of the above objects.

Type property as it applies to all other objects in the Applies To list.

Returns an FpFieldType constant that represents the type of the current field. Read-only.

FpFieldType can be one of these FpFieldType constants.
fpFieldChoice
fpFieldComputed
fpFieldCounter
fpFieldCurrency
fpFieldDateTime
fpFieldFile
fpFieldInteger
fpFieldLookup
fpFieldMultiLine
fpFieldNumber
fpFieldSingleLine
fpFieldTrueFalse
fpFieldURL
fpFieldUser

expression.Type

expression Required. An expression that returns one of the objects as mentioned above.

Example

As it applies to the BasicList, DocumentLibrary, List, and Survey objects.

The following example displays the names of all lists in the active web and their associated type names. If the active web contains no lists, a message is displayed to the user.

Sub ViewListTypes()
'Displays the name of the list and
'its associated type

    Dim lstWebList As List
    Dim strType As String

    If Not ActiveWeb.Lists Is Nothing Then
    'Cycle through lists
        For Each lstWebList In ActiveWeb.Lists
            'add types to string
            If strType = "" Then
                strType = lstWebList.Name & " - " & _
                lstWebList.Type & vbCr
            Else
                strType = strType & lstWebList.Name & " - " & _
                lstWebList.Type & vbCr
            End If
        Next
            'Display types of all lists in the web
            MsgBox "The list types in the current web are:" _
            & vbCr & strType
       Else
           'Otherwise display message to user
           MsgBox "The current web contains no lists."
     End If

End Sub

As it applies to all other objects in the Applies To list.

The following example displays the names of all fields in the first list of the Lists collection and their associated type names. If the active web contains no lists, a message is displayed to the user.

Sub Fieldtype()
'Displays the field types of the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application

    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            If strType = "" Then
                strType = objField.Name & " - " & _
                objField.Type & vbCr
            Else
                strType = strType & objField.Name & " - " & _
                objField.Type & vbCr
            End If
        Next objField
            MsgBox "The names of the fields in this list and their types are: " & _
            vbCr & strType
    Else
         'Otherwise display message to user
         MsgBox "The current web contains no lists."
         End If
End Sub


Url Property

Returns the URL for the specified object. Read-only String.

Remarks

URLs can be absolute or relative. An absolute URL contains the exact path to the specified object while a relative URL may contain characters such as "../..", "?", or ";" depending on the URL access scheme used to parse the relative URL. The Microsoft FrontPage object model always uses absolute URLs. For more information on URLs, see Understanding Absolute and Relative URLs in FrontPage.

Example

This example returns the URL of the first file in the root folder of the active web.

Private Sub GetFileUrl()
    Dim myFile As WebFile
    Dim myURL As String

    Set myFile = ActiveWeb.RootFolder.Files(0)
    myURL = myFile.Url

End Sub


UserName Property

Returns the logon name of the user that is currently logged on to the network or operating system. Read/write String.

Remarks

The UserName property is the default parameter whenever a user name is required for a parameter in the Web object model. For example, the Webs.Open and Webs.Publish methods both require a UserName parameter. When the parameter isn't specified, the default parameter is the user name of the user currently logged on.

Example

This example returns the current user's logon name.

myLogonName = Application.UserName


VBE Property

Returns a VBE object that represents the Visual Basic Editor.

expression.VBE

expression Required. An expression that returns an Application object.

Example

The following example creates a reference to the Visual Basic Editor and displays the name of the active project to the user.

Sub ReturnVBE()
'Creates a reference to the VBE and displays a message to user

    Dim objApp As FrontPage.Application
    Set objApp = FrontPage.Application
    'Display the name of the active project
    MsgBox "The name of the active project is: " & _
            objApp.VBE.ActiveVBProject.Name

End Sub


Version Property

Returns the version of the specified object with the format: "x.x.x", where x represents a number in the version. Read-only String.

Remarks

If the Application object is specified, the Version property returns the version of the application. When the Version property for the System object is accessed, it returns the current version of the operating system as you might see used on the Properties page of the System dialog box.

Example

The following example returns the version of the application.

Public Sub GetAppVersion()
    Dim myAppVersion As String

    myAppVersion = Application.Version
End Sub


VerticalResolution Property

Returns the vertical resolution of the screen in pixels. Read-only Long.

Example

This example returns the vertical resolution of the screen.

myVerticalRes = System.VerticalResolution


ViewMode Property

ViewMode property as it applies to the PageWindowEx object.

Returns or sets an FpPageViewMode constant that represents the view mode of the active page window. Read/write.

FpPageViewMode can be one of these FpPageViewMode constants.
fpPageViewNoFrames
fpPageViewNormal
fpPageViewNoWindow
fpPageViewPreview
fpPageViewDefault
fpPageViewHtml

expression.ViewMode

expression Required. An expression that returns a PageWindowEx object.

ViewMode property as it applies to the WebWindowEx object.

Returns or sets an FpWebViewMode constant that defines the view mode of the current window. Read/write.

FpWebViewMode can be one of these FpWebViewMode constants.
fpWebViewAllFiles
fpWebViewBrokenLinks
fpWebViewFolders
fpWebViewLinks
fpWebViewPage
fpWebViewSiteSummary
fpWebViewStructure
fpWebViewTodo

expression.ViewMode

expression Required. An expression that returns a W ebWindowEx object.

ViewMode property as it applies to the DispFPHTMLDocument object.

Returns a Long that represents the view mode of the document. Read-only.

expression.ViewMode(ViewMode)

expression Required. An expression that returns a DispFPHTMLDocument object.

ViewMode Required Long. The new viewing mode.

Example

As it applies to the PageWindowEx object.

The following example changes the view mode of the active window to the value fpPageViewNormal (normal view) if it is not already in the default view mode.

Sub ChangeViewMode()
'Changes the view mode of the active window

     Dim fpApp As FrontPage.Application
     Dim objPage As PageWindowEx

     Set fpApp = FrontPage.Application
     Set objPage = fpApp.ActivePageWindow

     If objPage.ViewMode <> fpPageViewDefault Then
         objPage.ViewMode = fpPageViewNormal
         MsgBox "The current page window has been restored " & _
             "to normal view."
     End If

End Sub

As it applies to the WebWindowEx object.

The following example changes the view mode of the active web window to fpWebBrokenLinks (Broken Links view) if the window is not already in the view.

Sub ChangeViewMode()
'Changes the view mode of the active window

    Dim fpApp As FrontPage.Application
    Dim objWebWindow As WebWindowEx

    Set fpApp = FrontPage.Application
    Set objWebWindow = fpApp.ActiveWebWindow

    If objWebWindow.ViewMode <> fpWebViewBrokenLinks Then
        objWebWindow.ViewMode = fpWebViewBrokenLinks
        MsgBox "The current page window has been restored " & _
            "to Broken Links view."
    End If

End Sub

As it applies to the DispFPHTMLDocument object.

The following example displays the view mode of the active document.

Sub DisplayViewMode()
'Changes the view mode of the active window

    Dim fpApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument

    Set fpApp = FrontPage.Application
    Set objDoc = fpApp.ActiveDocument

    Select Case objDoc.ViewMode

        Case 1
            MsgBox "The document is in Normal mode."
        Case 2
            MsgBox "The document is in HTML mode"
        Case 8
            MsgBox "The document is in Preview mode"

    End Select

End Sub


ViewModeEx Property

Returns or sets an FpWebViewModeEx enumerated constant that represents the current view mode of the web window. Read/write.

FpWebViewModeEx can be one of these FpWebViewModeEx constants.
fpWebViewExAllFiles
fpWebViewExAssignedTo
fpWebViewExBrokenLinks
fpWebViewExBrowserTypes
fpWebViewExCategories
fpWebViewExCheckoutStatus
fpWebViewExComponentErrors
fpWebViewExDailyPageHits
fpWebViewExDailySummary
fpWebViewExFolders
fpWebViewExLinks
fpWebViewExMonthlyPageHits
fpWebViewExMonthlySummary
fpWebViewExNavigation
fpWebViewExOlderFiles
fpWebViewExOsTypes
fpWebViewExPage
fpWebViewExPublishStatus
fpWebViewExRecentlyAddedFiles
fpWebViewExRecentlyChangedFiles
fpWebViewExReferringDomains
fpWebViewExReferringURLs
fpWebViewExReviewStatus
fpWebViewExSearchStrings
fpWebViewExSiteSummary
fpWebViewExSlowPages
fpWebViewExTodo
fpWebViewExUnlinkedFiles
fpWebViewExUsageSummary
fpWebViewExVisitingUsers
fpWebViewExWeeklyPageHits
fpWebViewExWeeklySummary

expression.ViewModeEx

expression Required. An expression that returns one of the objects in the Applies To list.

Example

The following example changes the view mode to display the daily page hits.

Sub ViewPageHits()
'Changes the current view mode to view page hits

    ActiveWeb.ActiveWebWindow.ViewModeEx = fpWebViewExDailyPageHits

End Sub


Visible Property

Returns or sets the visible state of the PageWindowEx or WebWindowEx object. The visible state for the PageWindowEx object is read-only Boolean. The visible state for the WebWindowEx object is read/write Boolean.

expression.Visible

expression Required. An expression that returns one of the objects in the Applies To list.

Example

In the following example, the GetVisibleState procedure returns the visible state of the first PageWindowEx object from the CheckIfVisible function.

Private Sub GetVisibleState()
    Dim myIsVisible As Boolean

    myIsVisible = CheckIfVisible
End Sub

Function CheckIfVisible() As Boolean
    Dim myPage As PageWindowEx
    Dim myVisibleState As Boolean

    Set myPage = Application.Webs(0).WebWindows(0).PageWindows(0)

    myVisibleState = myPage.Visible
    CheckIfVisible = myVisibleState
End Function

This example sets the visible state of a WebWindowEx object to a windowless state.

Private Sub OpenInNoWindow()
    Dim myWebWindow As WebWindowEx

    Set myWebWindow = Webs(0).WebWindows(0)

    myWebWindow.Visible = False
End Sub


vlinkColor Property

Returns or sets a Variant that specifies the color of all visited links in the current document. Read/write.

expression.vlinkColor

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

Values can be specified as a hexadecimal numeric representation or as an enumerated constant.

Example

The following example sets the color of all visited links in the current document to blue. The vlinkColor property is set to "3300FF", the hexadecimal representation of the color blue.

Sub ChangeLinkColor()
'Changes the color of visited links in the current document

    Dim objApp As FrontPage.Application
    Set objApp = FrontPage.Application
    'Set color of visited links to blue.
    objApp.ActiveDocument.vlinkColor = "3300FF"

End Sub


Web Property

Returns the read-only Microsoft FrontPage-based web container for the specified object.

expression.Web

expression Required. An expression that returns one of the above objects.

Example

This example returns the title of a FrontPage-based web.

Private Sub GetWebTitle()
    Dim myWeb As WebEx
    Dim myWebName As String

    Set myWeb = ActiveWeb

    myWebName = myWeb.RootFolder.Web.Title

End Sub


webbots Property

Returns an IHTMLElementCollection collection that represents the collection of all webbots in the current document.

expression.webbots

expression Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example creates a reference to the current document's webbots collection and displays the number of webbots in the current page.

Sub ReturnWebBots()
'Returns the collection of all webbots in the document

    Dim objApp As FrontPage.Application
    Dim objBots As IHTMLElementCollection
    Dim objBot As IHTMLElement
    Dim intCount As Integer

    intCount = 0
    Set objApp = FrontPage.Application
    Set objBots = objApp.ActiveDocument.webbots
    'For each webbot in the document
    For Each objBot In objBots
       'Keep count of number of webbots
       intCount = intCount + 1
    Next objBot

    'Display number of webbots in collection
    If intCount = 0 Then
        MsgBox "There are no webbots in the current document."
    Else
        MsgBox "There are " & intCount & " webbots in the current document."
    End If

End Sub


Webs Property

Returns the collection of open webs for the specified object.

Example

This example creates an array that contains all of the URLs for all the open webs on your Web site.

Note You must open any webs for which you wish to retrieve the URLs.

Private Sub GetWebs()
    Dim myWebs As Webs
    Dim myWeb As WebEx
    Dim myOpenWebs() As Variant
    Dim i As Integer
    Dim myWebCount As Integer

    Set myWebs = Application.Webs
    myWebCount = myWebs.Count

    ReDim myOpenWebs(myWebCount)

    Do
        For Each myWeb In myWebs
                myOpenWebs(i) = myWeb.Url
                i = i + 1
        Next
    Loop Until i > myWebCount

End Sub


WebWindows Property

Returns the collection of open WebWindows objects in the specified object.

Example

This example checks if any of the web windows are set to Page view, and changes those that are in Page view to Folders view.

Private Sub GetViewModes()
    Dim myWebWindows As WebWindows
    Dim myWebWindow As WebWindowEx
    Dim myView As FpWebViewMode

    Set myWebs = Webs
    Set myWebWindows = myWebs.WebWindows

    For Each myWebWindow In myWebWindows
            myView = myWebWindow.ViewMode
            If myView = fpWebViewPage Then
                myWebWindow.ViewMode = fpWebViewFolders
            End If
    Next
End Sub


OnActivate Event

Occurs when the page window or web window obtains the focus and becomes the current window.

Private Sub expression_OnActivate( )

expression A variable which references an object of type PageWindowEx or WebWindowEx declared with events in a class module.

Example

The following example uses the IsDirty property to determine if the PageWindowEx object is dirty—that is, if it has been modified since the last refresh or save. The following example saves the PageWindowEx object if the first item in the PageWindows collection is dirty.

Private Sub PgeWindowEx_OnActivate()
'Displays a message when the window obtains focus

    If PgeWindowEx.IsDirty Then
        PgeWindowEx.Save
    End If

End Sub


OnAfterPageSave Event

Occurs after a page is saved.

Private Sub Application_OnAfterPageSave(ByVal pPage As PageWindow, Success As Boolean)

pPage Required PageWindowEx. A PageWindowEx object.

Success Required Boolean. True if the PageWindowEx object was successfully saved.

Remarks

The OnAfterPageSave event is associated with the Application object. After the user saves a page or closes Microsoft FrontPage, the OnAfterPageSave event fires and executes the code that you specified within the event procedure.

Example

This example displays a message box after the page has been saved and displays the file name of the page.

Note To run this example, you must have at least one open web and one open page within that web.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdSave, and a button called cmdCancel. Add the following code to the Declarations section of the form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdSave_Click section of the code window.

Private Sub cmdSave_Click()
    Dim myPageWindow As PageWindowEx

    Set myPageWindow = ActiveWeb.ActiveWebWindow.ActivePageWindow
    myPageWindow.Save
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnAfterPageSave section of the code window.

Private Sub eFPApplication_OnAfterPageSave(ByVal pPage As _
        PageWindow, Success As Boolean)
    If Success = True Then
        MsgBox "The following page was saved: " & pPage.File.Name
    Else
         MsgBox "There was a problem with saving your page: " & _
        pPage.File.Name
    End If
End Sub


OnAfterPageWindowViewChange Event

Occurs when a page window has switched view types.

Private Sub application__OnAfterPageWindowViewChange(ByVal pPage As PageWindow)

application An object of type Application declared with events in a class module.

pPage The PageWindowEx object in which the view has changed.

Example

The following example prompts the user to refresh the window after it has changed view modes.

Private Sub objApp_OnAfterPageWindowViewChange(ByVal pPage As PageWindow)
'Occurs when a view changes

    Dim strAns As String
    'Prompt user to refresh view
    strAns = MsgBox("The view has changed, would you like to refresh the window?", vbYesNo)
    If strAns = vbYes Then
        pPage.Refresh
    End If

End Sub


OnAfterPublish Event

Occurs after a web is published.

Private Sub expression_OnAfterPublish(Success As Boolean)

expression A variable name which references an object of type WebEx declared with events in a class module.

Success A Boolean that determines if the publish operation was successful. If True, the web was successfully published.

Example

The following example displays a message to the user based on the result of the Publish method.

Private Sub objWeb_OnAfterPublish(Success As Boolean)
'Occurs after a web is published

    If Success = True Then
        MsgBox "The web was published successfully."
    Else
        MsgBox "An error occurred, the web was not published.", vbExclamation
    End If

End Sub


OnAfterSave Event

Occurs after the active document has been saved by the user.

Private Sub expression_OnAfterSave(Success As Boolean)

expression A variable name which references an object of type PageWindowEx declared with events in a class module.

Success A Boolean that indicates if the operation was successful. If True, the file was saved.

Example

The event in the following example occurs after the active document is saved in an extended page window. A message is displayed to the user based on the result of the operation.

Private Sub PgeWindowEx_OnAfterSave(Success As Boolean)
'Displays message based on value of Success

    If Success = True Then
        MsgBox "The file " & PgeWindowEx.ActiveDocument.Title & " was saved."
    Else
        MsgBox "The file " & PgeWindowEx.ActiveDocument.Title & " was not saved."
    End If

End Sub


OnAfterSubViewChange Event

Occurs after the web window subview changes.

Private Sub expression_OnAfterSubViewChange( )

expression A variable name which references an object of type WebWindowEx declared with events in a class module.

Example

The following example displays a message to the user whenever the subview of the active web window changes or after the subview closes.

Private Sub objWebWindow_OnAfterSubViewChange()
 'Display a message indicating which view the subwindow is currently in

    Select Case objwebWindow.SubViewMode
        Case fpWebSubViewFolders
            MsgBox "The view in the subwindow has changed to Folder View."
        Case fpWebSubViewNavigation
            MsgBox "The view in the subwindow has changed to Navigation View."
        Case fpWebSubViewNone
            MsgBox "The sub window has closed."
    End Select

End Sub


OnAfterViewChange Event

Occurs after the view has changed in the active page window or web window.

Private Sub expression_OnAfterViewChange( )

expression A variable name which references an object in the Applies To list declared with events in a class module.

Example

The following example displays the name of the new page window view mode.

Private Sub PgeWindowEx_OnAfterViewChange()
'Occurs when the view changes in the active window

    MsgBox "The page has changed to " & PgeWindowEx.ViewMode & "."

End Sub


OnAfterWebPublish Event

Occurs after a web is published.

Private Sub Application_OnAfterWebPublish(ByVal pWeb As Web, Success As Boolean)

pWebEx Required WebEx. The specified WebEx object.

Success Required Boolean. True if the specified web was successfully published.

Remarks

The OnAfterWebPublish event is associated with the Application object. After the user publishes a web in Microsoft FrontPage, the OnAfterWebPublish event fires and executes the code that you specified within the event procedure.

Example

This example creates a property with the value of True after a web has been published.

Note To run this example you must have one web open. This example uses a web called Rogue Cellars. You can create a web called Rogue Cellars, or you can substitute a web of your choice in the following code sample.

Create a form called frmLaunchEvents.frm and add two command buttons, a button called cmdPublishWeb, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdPublishWeb_Click section of the code window.

Private Sub cmdPublishWeb_Click()
    ActiveWeb.Publish "C:\My Documents\My Webs\Rogue Cellars"
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnAfterWebPublish section of the code window. This code adds a property called Published to the web that contains the value True.

Private Sub eFPApplication_OnAfterWebPublish(ByVal pWeb As Web, Success As Boolean)
    If Success = True Then
        pWeb.Properties.Add "Published", True
        pWeb.Properties.ApplyChanges
    Else
        MsgBox "There was a problem publishing your " & pWeb & " web."
    End If
End Sub


OnAfterWebWindowSubViewChange Event

Occurs after the Folder list in the Web view sub window has changed from the Folder List view to Navigation view.

Private Sub application__OnAfterWebWindowSubViewChange(ByVal pWebWindow As WebWindow)

application An object of type Application declared with events in a class module.

pWebWindow The WebWindowEx object in which the view has changed.

Example

The following example displays the name of the view type in the sub window, unless the sub window is closed by the user.

Private Sub objApp_OnAfterWebWindowSubViewChange(ByVal pWebWindow As WebWindow)
'Occurs when a sub view in the Web window changes

    'Display a message indicating what view the sub window is currently in
    Select Case pWebWindow.SubViewMode
        Case fpWebSubViewFolders
            MsgBox "The view in the sub window has changed to Folder View."
        Case fpWebSubViewNavigation
            MsgBox "The view in the sub window has changed to Navigation View."
        Case fpWebSubViewNone
            MsgBox "The sub window has closed."
    End Select

End Sub


OnAfterWebWindowViewChange Event

Occurs after the Web window view has changed.

Private Sub application__OnAfterWebWindowViewChange(ByVal pWebWindow As WebWindow)

application An object of type Application declared with events in a class module.

pWebWindow The WebWindowEx object in which the view has changed.

Example

The following example displays the name of the new view type to the user every time the view is changed.

Private Sub objApp_OnAfterWebWindowViewChange(ByVal pWebWindow As WebWindow)
'Occurs after the Web window view changes

    'Display message to user
    MsgBox "The view has changed to " & pWebWindow.ViewModeEx & " mode."

End Sub


OnBeforePageSave Event

Occurs before a page is saved.

Private Sub Application_OnBeforePageSave(ByVal pPage As PageWindow, SaveAsUI As Boolean, Cancel As Boolean)

pPage Required PageWindowEx. The specified PageWindowEx object.

SaveAsUI Required Boolean. True for the first time the page has been saved. If SaveAsUI is True then the user used the SaveAs dialog box to save the page; if SaveAsUI is False, then the user used the Save dialog box to save an existing file.

Cancel Required Boolean. Causes Microsoft FrontPage to abort the save when set to True. When Cancel is programmatically set to True, the user can abort the save process by clicking the Cancel button on the form. Default is False.

Remarks

The OnBeforePageSave event is associated with the Application object. When the user saves a page or closes FrontPage, the OnBeforePageSave event fires and executes the code that you specified within the event procedure.

Note If you set Cancel to True, the page won't be saved.

Example

This example displays a message box before the page has been saved and displays the document title of the file for the page.

Note To run this example, you must have at least one open web and one open page within that web.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdSave, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdSave_Click section of the code window.

Private Sub cmdSave_Click()
    Dim myPageWindow As PageWindowEx

    Set myPageWindow = ActiveWeb.ActiveWebWindow.ActivePageWindow
    myPageWindow.Save
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnBeforePageSave section of the code window.

Private Sub eFPApplication_OnBeforePageSave(ByVal pPage As _
        PageWindow, SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox "The following page will be saved: " & pPage.File.Name _
        & "will be saved with the title: " & pPage.Document.Title
End Sub


OnBeforePageWindowViewChange Event

Occurs before the current Page window view is changed.

Private Sub application__OnBeforePageWindowViewChange(ByVal pPage As PageWindow, ByVal TargetView As FpPageViewMode, Cancel As Boolean)

application An object of type Application declared with events in a class module.

pPage The PageWindowEx object in which the view has changed.

TargetView The specified target window type.

Cancel A Boolean that determines if the event will be cancelled. If False, the event will not be cancelled. If True, the event will be cancelled.

Remarks

This event can be cancelled.

Example

The following example prompts the user before the current view is changed. The Cancel argument is modified based on the users' response.

Private Sub objApp_OnBeforePageWindowViewChange(ByVal pPage As PageWindow, ByVal TargetView As FpPageViewMode,
                                                _ Cancel As Boolean)
'Prompts the user before changing the view type

    Dim strAns As String
    'Prompt user to change view
    strAns = MsgBox("Are you sure you want to change the current view", _
                    vbYesNo)
    If strAns = vbYes Then
        'Don't cancel event
        Cancel = False
    Else
        'Cancel event
        Cancel = True
End Sub


OnBeforePublish Event

Occurs before a web is published.

Private Sub expression_OnBeforePublish(Destination As String, Cancel As Boolean)

expression A variable name which references an object of type WebEx declared with events in a class module.

Destination A String that specifies the URL of the published web.

Cancel A Boolean that determines if the publish operation will be cancelled. If True, the web will not be published.

Remarks

This event can be cancelled.

Example

The following example displays a message to the user before a web is published. It also allows the user to cancel the event before it occurs.

Private Sub expression_OnBeforePublish(Destination As String, Cancel As Boolean)
'Occurs before a web is published.

    Dim strAns As Boolean

    strAns = MsgBox _
        ("Are you sure you want to publish to the following destination: " & _
            Destination)
    If strAns = False Then
        Cancel = True
    Else
        Cancel = False
    End If

End Sub


OnBeforeSave Event

Occurs before a page in an active extended page window is saved.

Private Sub expression_OnBeforeSave(SaveAsUI As Boolean, Cancel As Boolean)

expression A variable name which references an object of type PageWindowEx declared with events in a class module.

SaveAsUI A Boolean that determines if the user interface will be displayed. If True, the Save dialog will be displayed.

Cancel A Boolean that determines if the save operation will be cancelled. If True, the document will not be saved.

Example

The following example prompts the user before saving the document. If the user clicks No, the document will not be saved. If the user clicks Yes, the document will be saved.

Private Sub PgeWindowEx_OnBeforeSave(SaveAsUI As Boolean, Cancel As Boolean)
'Prompt user before saving the document

    Dim strAns As String
    strAns = MsgBox("Do you really want to save the document?", vbYesNo)
    'Change cancel value based on user input
    If strAns = VbNo Then
        Cancel = True
    End If

End Sub


OnBeforeSubViewChange Event

Occurs before the subview of the web window changes.

Private Sub expression_OnBeforeSubViewChange(ByVal TargetSubView As FpWebSubView, Cancel As Boolean)

expression A variable name which references an object of type WebWindowEx declared with events in a class module.

TargetSubView An FpWebSubView enumerated constant that represents the new subview type.

Cancel A Boolean that determines if the operation will be cancelled. If False, the subview will change view types.

Example

The following example prompts the user before changing the subview of the web window. If the user clicks No, the subview will not change. If the user clicks Yes, the subview will change to a new view type.

Private Sub objwebWindow_OnBeforeSubViewChange
                      (ByVal TargetSubView As FpWebSubView, Cancel As Boolean)
'Occurs when the subview of the active web window is changed

    Dim strAns As String
    'Prompt user
    strAns = MsgBox("Are you sure you want to change the subview?", vbYesNo)
    If strAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If

End Sub


OnBeforeViewChange Event

OnBeforeViewChange event as it applies to the PageWindowEx object.

Occurs before the view mode of the PageWindowEx object is changed.

Private Sub expression_OnBeforeViewChange(ByVal TargetView As FpPageViewMode, Cancel As Boolean)

expression A variable name which references an object of type PageWindowEx declared with events in a class module.

TargetView An FpPageViewMode enumerated constant that represents the new view type.

Cancel A Boolean that determines if the operation will be cancelled. If True, the view will not be changed.

OnBeforeViewChange event as it applies to the WebWindowEx object.

Occurs before the view mode of the WebWindowEx object is changed.

Private Sub expression_OnBeforeViewChange(ByVal TargetView As FpWebViewMode, Cancel As Boolean)

expression A variable name which references an object of type WebWindowEx declared with events in a class module.

TargetView An FpWebViewMode enumerated constant that represents the new view type.

Cancel A Boolean that determines if the operation will be cancelled. If True, the view will not be changed.

Example

The following example prompts the user before changing views. If the user clicks Yes, the view is changed.

Private Sub PgeWindowEx_OnBeforeViewChange(ByVal TargetView As FpPageViewMode, _
                                                    Cancel As Boolean)
'Prompts user before changing views

    Dim blnAns As Boolean
    strAns = MsgBox("Are you sure you want to change the current view?", _
                    vbYesNo)
    If strAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If

End Sub


OnBeforeWebPublish Event

Occurs before a web is published.

Private Sub Application_OnBeforeWebPublish(ByVal pWeb As Web, Destination As String, Cancel As Boolean)

pWeb Required WebEx. The specified WebEx object.

Destination Required String. The URL of the target location.

Cancel Required Boolean. Causes Microsoft FrontPage to abort the publish when set to True. When Cancel is programmatically set to True, the user can abort the save process by clicking the Cancel button on the form. Default is False.

Remarks

The OnBeforeWebPublish event is associated with the Application object. When the user publishes a web in Microsoft FrontPage, the OnBeforeWebPublish event fires and executes the code that you specified within the event procedure.

Example

This example adds a copyright string to the index page of the web that's being published.

Note To run this example, you must have at least one open web. This example uses a web called Rogue Cellars. You can create a web called Rogue Cellars or you can substitute a web of your choice in the following code sample.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdPublishWeb, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdPublishWeb_Click section of the code window.

Private Sub cmdPublishWeb_Click()
    ActiveWeb.Publish "C:\My Documents\My Webs\Rogue Cellars"
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnBeforeWebPublish section of the code window.

Private Sub eFPApplication_OnBeforeWebPublish(ByVal pWeb As Web, _
        Destination As String, Cancel As Boolean)
    Dim myCopyright As String
    Dim myIndexFile As WebFile

    myCopyright = "Copyright 1999 by Rogue Cellars"
    Set myIndexFile = pWeb.RootFolder.Files("index.htm")
    myIndexFile.Open
    If myIndexFile.Application.ActiveDocument.body.outerText <> _
            myCopyright Then
        myIndexFile.Application.ActiveDocument.body.insertAdjacentText _
            "BeforeEnd", myCopyright
    End If
    ActivePageWindow.Close
End Sub


OnBeforeWebWindowSubViewChange Event

Occurs before the sub window of the current web window is changed by the user.

Private Sub application__OnBeforeWebWindowSubViewChange(ByVal pwebwindow As WebWindow, ByVal TargetSubView As FpWebSubView, Cancel As Boolean)

application An object of type Application declared with events in a class module.

pWebWindow The WebWindowEx object that contains the sub window.

TargetSubView The sub window view type.

Cancel A Boolean that determines if the event will be cancelled. If False, the event will not be cancelled. If True, the event will be cancelled.

Example

The following example prompts the user before the current sub window view is changed. The Cancel argument is modified based on the users' response.

Private Sub objApp_OnBeforeWebWindowSubViewChange(ByVal pwebwindow As WebWindow, _
                                                  ByVal TargetSubView As FpWebSubView, _
                                                  Cancel As Boolean)
'Occurs before the web window sub view is changed. Prompts the user to verify the change

    Dim strAns As String
    'Prompt the user before changing views
    strAns = MsgBox("Are you sure you want to change the sub window view?", _
                     vbYesNo)
    If strAns = vbYes Then
        'Yes, don't cancel the event
        Cancel = False
    Else
        'No, cancel the event
        Cancel = True
    End If

End Sub


OnBeforeWebWindowViewChange Event

Occurs before the web window view changes.

Private Sub application__OnBeforeWebWindowViewChange(ByVal pWebWindow As WebWindow, ByVal TargetView As FpWebViewModeEx, Cancel As Boolean)

application An object of type Application declared with events in a class module.

pWebWindow The WebWindowEx object that contains the view.

TargetView The FPWebViewModeEx window view type.

Cancel A Boolean that determines if the event will be cancelled. If False, the event will not be cancelled. If True, the event will be cancelled.

Example

The following example prompts the user before the current view is changed. The Cancel argument is modified based on the users' response.

Private Sub objApp_OnBeforeWebWindowViewChange(ByVal pWebWindow As WebWindow, _
                                               ByVal TargetView As FpWebViewModeEx, _
                                               Cancel As Boolean)
'Occurs before the view is changed in the web window. Prompts the user to verify the change

    Dim strAns As String
    'Prompt the user before changing views
    strAns = MsgBox("Are you sure you want to change the view mode?", _
                     vbYesNo)
    If strAns = vbYes Then
        'Yes, don't cancel the event
        Cancel = False
    Else
        'No, cancel the event
        Cancel = True
    End If
End Sub


OnClose Event

OnClose event as it applies to the PageWindowEx object.

Occurs when the active page window is closed by the user.

Private Sub expression_OnClose(Cancel As Boolean)

expression A variable name which references an object of type PageWindowEX declared with events in a class module.

Cancel A Boolean that determines if the operation will be cancelled. If True, the active page window will not be closed.

OnClose event as it applies to the WebEx object.

Occurs when the active web window is closed by the user.

Private Sub expression_OnClose(pCancel As Boolean)

expression A variable name which references an object of type WebEx declared with events in a class module.

Cancel A Boolean that determines if the operation will be cancelled. If True, the active web will not be closed.

Example

The following example prompts the user before closing the active page window. If the user clicks No, the window will not close.

Private Sub PgeWindowEx_OnClose(Cancel As Boolean)
'Displays a message

    Dim strAns As String
    'Prompt user
    strAns = MsgBox("Are you sure you want to close the active page window?", _
                    vbYesNo)
    If strAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If

End Sub


OnDeactivate Event

Occurs when the active web window loses focus and is deactivated.

Private Sub expression_OnDeactivate( )

expression A variable name which references an object of type WebWindowEx declared with events in a class module.

Example

The following example displays a message to the user when the window is deactivated.

Private Sub objWebWindow_OnDeactivate()
'Occurs when the current web window is deactivated

    MsgBox "The window has been deactivated."

End Sub


OnPageClose Event

Occurs when a page is closed.

Private Sub Application_OnPageClose(ByVal pPage As PageWindow, Cancel As Boolean)

pPage Required PageWindowEx. The specified PageWindowEx object.

Cancel Required Boolean. Causes Microsoft FrontPage to abort the close when set to True. When Cancel is programmatically set to True, the user can abort the save process by clicking the Cancel button on the form. Default is False.

Remarks

The OnPageClose event is associated with the Application object. When the user closes a PageWindowEx object, the OnPageClose event fires and executes the code that you specified within the event procedure.

Example

This example checks if a page has been modified and saves the page if the IsDirty property is True before closing the page.

Note To run this example, you must have at least one open web and one open page within that web.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdClosePage, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdClosePage_Click section of the code window.

Private Sub cmdClosePage_Click()
    ActivePageWindow.Close
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnPageClose section of the code window.

Private Sub eFPApplication_OnPageClose(ByVal pPage As _
        PageWindow, Cancel As Boolean)
    If pPage.IsDirty = True Then pPage.Save
End Sub


OnPageNew Event

Occurs when a new page is created.

Private Sub Application_OnPageNew(ByVal pPage As PageWindow)

pPage Required PageWindowEx. A PageWindowEx object.

Remarks

When the user creates a new page within a frameset, the OnPageNew event is only fired once for Frames pages—when the page containing the frameset tags is opened. Then FrontPage executes the code that you specified within the event procedure.

Note The OnPageNew event only fires for the default frameset, even if there are more frames on the page. This event only fires if FrontPage is in Page view. If FrontPage is in any other view, the OnPageNew event won't fire.

Example

This example applies a theme to a new page.

Note To run this example, you must have at least one open web. This example uses Rogue Cellars as the specified web and Zinfandel.htm as the specified page. You can create a web and page using these names or you can substitute a web and page of your choice.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdAddPage, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdAddPage_Click section of the code window. This code adds a file to the PageWindows collection and opens it.

Private Sub cmdAddPage_Click()
    Dim myPageWindows As PageWindows
    Dim myFile As String

    Set myPageWindows = ActiveWeb.ActiveWebWindow.PageWindows
    myFile = _
        "file:///C:/My Documents/My Webs/Rogue Cellars/Zinfandel.htm"
    myPageWindows.Add (myFile)
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnPageNew section of the code window.

Private Sub eFPApplication_OnPageNew(ByVal pPage As PageWindow)
    pPage.ApplyTheme ("artsy")
End Sub


OnPageOpen Event

Occurs when a page is opened.

Private Sub Application_OnPageOpen(ByVal pPage As PageWindow)

pPage Required PageWindowEx. A PageWindowEx object.

Remarks

The OnPageOpen event is associated with the Application object. When the user opens a page, Microsoft FrontPage opens the frameset for the page and fires the OnPageOpen event for the default frameset. Then FrontPage executes the code that you specified within the event procedure.

Note The OnPageOpen event only fires for the default frameset, even if there are more frames on the page.The OnPageOpen event only fires if the page is not open.

Example

This example changes the title of the FPHTMLDocument object, when the document is opened in a PageWindowEx object.

Note To run this example, you must have at least one open web. This example uses Rogue Cellars as the specified web and Zinfandel.htm as the specified page. You can create a web and page using these names or you can substitute a web and page of your choice.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdOpenPage, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdAddPage_Click section of the code window.

Private Sub cmdAddPage_Click()
    Dim myPageWindows As PageWindows
    Dim myFile As String

    Set myPageWindows = ActiveWeb.ActiveWebWindow.PageWindows
    myFile = _
        "file:///C:/My Documents/My Webs/Rogue Cellars/Zinfandel.htm"
    myPageWindows.Add (myFile)
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnPageOpen section of the code window.

Private Sub eFPApplication_OnPageOpen(ByVal pPage As _
        PageWindow)
    Dim myDoc As FPHTMLDocument

    Set myDoc = pPage.ActiveDocument

    myDoc.Title = "Rogue Cellars Home Page"
End Sub


OnPageWindowActivate Event

Occurs when the page in the current window obtains focus.

Private Sub expression_OnPageWindowActivate(ByVal pPage As PageWindow)

expression The variable name of an object of type Application declared with events in a class module.

pPage The PageWindowEx object that contains the view.

Example

The following example prompts the user to refresh the page each time the page window obtains focus.

Private Sub objApp_OnPageWindowActivate(ByVal pPage As PageWindow)
'Occurs when current page in the main window obtains focus.
'Prompts the user to refresh the current page.

     Dim strAns As String
     strAns = MsgBox("Do you want to refresh the page " & pPage.Caption & "?", _
                      vbYesNo)
     If strAns = vbYes Then
         pPage.Refresh
     End If

End Sub


OnRecalculateHyperlinks Event

Occurs before the hyperlink structure in the Hyperlinks view is recalculated to view any changes made to the web.

Private Sub expression_OnRecalculateHyperlinks(ByVal pWeb As Web, Cancel As Boolean)

expression An object of type Application declared with events in a class module.

pWeb The WebEx object that contains the view.

Cancel A Boolean that determines if the event will be cancelled. If False, the event will not be cancelled. If True, the event will be cancelled .

Example

The following example prompts the user before recalculating the hyperlink structure. If the user accepts, the event will continue and the hyperlinks will be recalculated.

Private Sub objApp_OnRecalculateHyperlinks(ByVal pWeb As Web, Cancel As Boolean)
'Occurs when the current web's hyperlinks are recalculated.

    Dim strAns As String
    strAns = MsgBox("This action will cause the hyperlinks structure to be recalculated. " _
                     & "Do you want to continue?", vbYesNo)
    'Set value of Cancel argument to users' response
    If strAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If

End Sub


OnWebClose Event

Occurs when a web is closed.

Private Sub Application_OnWebClose(ByVal pWeb As Web, Cancel As Boolean)

pWeb Required WebEx. A WebEx object.

Cancel Required Boolean. True if the closing process was cancelled through the user interface, or if Cancel was set to True. Default is False.

Remarks

The OnWebClose event is associated with the Application object. When you close a web, the OnWebClose event fires and executes the code that you specified within the event procedure.

Example

This example iterates through the open pages and, if necessary, saves them before the web is closed.

Note To run this example, you must have at least one open web and one open page within that web. This example uses Rogue Cellars as the specified web. You can create a web called Rogue Cellars or substitute a web of your choice.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdCloseWeb, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdCloseWeb_Click section of the code window. This code sample closes the specified web.

Private Sub cmdCloseWeb_Click()
    Webs("file:///C:/My Documents/My Webs/Rogue Cellars").Close
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnWebClose section of the code window. This code sample iterates through the open pages and saves them if they have been modified.

Private Sub eFPApplication_OnWebClose(ByVal pWeb As Web, _
        Cancel As Boolean)
    Dim myPageWindows As PageWindows
    Dim myPageWindow As PageWindowEx

    Set myPageWindows = pWeb.ActiveWebWindow.PageWindows

    For Each myPageWindow In myPageWindows
        If myPageWindow.IsDirty = True Then myPageWindow.Save
    Next
End Sub


OnWebFileCheckOut Event

Occurs when a file in the current web is checked out.

Private Sub expression_OnWebFileCheckOut(ByVal pWeb As Web, ByVal pFile As WebFile, CheckedOut As Boolean, pCheckOutOption As FpCheckOutOption)

expression The variable name that references an object of type Application declared with events in a class module.

pWeb The current WebEx object that contains the file.

pFile The WebFile being checked out.

CheckedOut A Boolean that indicates the status of the file. If True, the file is checked out. If False, the file has not been checked out.

pCheckOutoption FpCheckOutOption. Specifies the checkout file option.

FpCheckOutOption can be one of these FpCheckOutOption constants.
FPCheckOut Default. Check the file out.
FPCheckOutCancel Cancel the file check out.
FPCheckOutReadOnly Checks out a read-only version of the file.
FPCheckOutPromptUser Prompts the user before checking out the file.

Example

The following example prompts the user before the file is checked out.

Private Sub objApp_OnWebFileCheckOut(ByVal pWeb As Web, ByVal pFile As WebFile,
                                     _ CheckedOut As Boolean, _
                                      pCheckOutOption As FpCheckOutOption)
'Occurs when a file in the current web is checked out.

    'Prompt the user before checking out the file
    pCheckOutOption = fpCheckOutPromptUser

End Sub


OnWebNew Event

Occurs when a new web is created.

Private Sub Application_OnWebNew(ByVal pWeb As Web)

pWeb Required WebEx. A WebEx object.

Remarks

The OnWebNew event is associated with the Application object. When the user creates a new web in Microsoft FrontPage, the OnWebNew event fires and executes the code that you specified within the event procedure.

Example

This example creates a temporary web and adds a new file.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdCreateWeb, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdCreateWeb_Click section of the code window.

Private Sub cmdCreateWeb_Click()
    Webs.Add ("file:///C:/My Documents/My Webs/TempWeb")
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnWebNew section of the code window.

Private Sub eFPApplication_OnWebNew(ByVal pWeb As Web)
    Dim myFile As WebFile

    Set myFile = pWeb.RootFolder.Files.Add("index.htm")
    myFile.Open
End Sub


OnWebOpen Event

Occurs when a web is opened.

Private Sub Application_OnWebOpen(ByVal pWeb As Web)

pWeb Required WebEx. A WebEx object.

Remarks

The OnWebOpen event is associated with the Application object. When the user opens a web in Microsoft FrontPage, the OnWebOpen event fires and executes the code that you specified within the event procedure.

Example

This example opens the Index.htm file when a web is opened.

Note This example uses Rogue Cellars as the specified web to be opened. You can create a web called Rogue Cellars or you can substitute a web of your choice.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdOpenWeb, and a button called cmdCancel. Add the following code to the Declarations section of a form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

Add the following code to the UserForm_Initialize section of the code window.

Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

Add the following code to the cmdOpenWeb_Click section of the code window.

Private Sub cmdOpenWeb_Click()
    Webs.Open ("file:///C:/My Documents/My Webs/Rogue Cellars")
End Sub

Add the following code to the cmdCancel_Click section of the code window.

Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

Add the following code to the eFPApplication_OnWebOpen section of the code window.

Private Sub eFPApplication_OnWebOpen(ByVal pWeb As Web)
    Dim myFile As WebFile

    Set myFile = pWeb.RootFolder.Files.Add("index.htm")
    myFile.Open
End Sub


WindowActivate Event

Occurs when a window is activated.

Private Sub expression_WindowActivate(ByVal pWebWindow As WebWindow)

expression The variable name of an object of type Application declared with events in a class module.

pWebWindow The WebWindowEx object.

Remarks

When an instance of Microsoft FrontPage obtains focus, a WindowActivate event will fire for each open window.

Example

The following example prompts the user to close the window when the web window obtains focus.

Private Sub expression_WindowActivate(ByVal pWebWindow As WebWindow)
'Occurs when a FrontPage window obtains focus.

    Dim strAns As String
    strAns = MsgBox("Are you sure you want to open the window " _
                     & pWebWindow.Caption & "?", _
                     vbYesNo)
    If strAns = vbNo Then
        pWebWindow.Close
    End If

End Sub


WindowDeactivate Event

Occurs when a web window is deactivated.

Private Sub expression_WindowDeactivate(ByVal pWebWindow As WebWindow)

expression The variable name of an object of type Application declared with events in a class module.

pWebWindow The WebWindowEx object.

Example

The following example prompts the user to close the window when the window loses focus.

Private Sub expression_WindowDeactivate(ByVal pWebWindow As WebWindow)
'Occurs when a Microsoft FrontPage window loses focus.

    Dim strAns As String
    strAns = MsgBox("Do you want to close this window?" _
                     & pWebWindow.Caption & "?", _
                     vbYesNo)
    If strAns = vbYes Then
        pWebWindow.Close
    End If

End Sub


Hidden Language Element

You have requested Help for a language element that is hidden, and therefore unavailable for programmatic access.


Returning an Object from a Collection

The Item property returns a single object from a collection. The following statements set the fileOne variable to a WebFile object that represents the first file in the Files collection.

Dim fileOne As WebFile

Set fileOne = ActiveWeb.RootFolder.Files.Item(0)

The Item property is the default property for most collections, so you can omit the Item keyword as shown in the following statement.

Set fileOne = ActiveWeb.RootFolder.Files(0)

Named Objects

Although you can usually specify an integer value with the Item property, it may be more convenient to return an object by name. The following example edits a file named Web Sales.htm in the active web.

ActiveWeb.RootFolder.Files("Web Sales.htm").Edit


Unsupported Language Element

You have requested Help for a language element that is not supported.


OnDeactivate Event


Application Object


Application Object
OnAfterSubViewChange Event

 OnAfterViewChange Event

 OnAfterWebWindowSubViewChange Event

 OnAfterWebWindowViewChange Event

 OnBeforePageWindowViewChange Event


WebEx Object
OnAfterWebPublish Event


PageWindowEx Object
OnAfterPageSave Event


WebWindowEx Object


PageWindowEx Object

 WebWindowEx Object
OnAfterPageWindowViewChange Event

 OnAfterSubViewChange Event

 OnAfterWebWindowSubViewChange Event

 OnAfterWebWindowViewChange Event


Application Object
OnAfterPageWindowViewChange Event

 OnAfterSubViewChange Event

 OnAfterViewChange Event

 OnAfterWebWindowViewChange Event

 OnBeforePageWindowViewChange Event

 OnBeforeSubViewChange Event

 OnBeforeViewChange Event

 OnBeforeWebWindowSubViewChange Event

 OnBeforeWebWindowViewChange Event


WebEx Object
OnAfterPublish Event


PageWindowEx Object


PageWindowEx Object

 WebWindowEx Object
OnBeforePageWindowViewChange Event

 OnBeforeWebWindowSubViewChange Event

 OnBeforeWebWindowViewChange Event


PageWindowEx Object

 WebEx Object


WebWindowEx Object
OnActivate Event


Application Object

 WebEx Object
NavigationNode Object

 NavigationNode Property

 NavigationNodes Collection Object


Application Object

 WebEx Object


PageWindowEx Object

 WebEx Object

 WebWindowEx Object


ListFields Collection

 Lists Collection

 NavigationNodes Collection Object

 PageWindows Collection Object

 Properties Collection Object

 WebFiles Collection Object

 WebFolders Collection Object

 WebWindows Collection Object

 Webs Collection Object


ListFieldChoice Object


NavigationNodes Collection Object


BasicList Object

 DocumentLibrary Object

 List Object

 Properties Collection Object

 Survey Object


WebEx Object


PageWindowEx Object

 WebEx Object

 WebFile Object

 WebFiles Collection Object


WebFile Object


DispFPHTMLDocument Object
selection Property


DispFPHTMLDocument Object

 PageWindowEx Object

 PageWindows Collection Object

 WebEx Object

 WebWindowEx Object

 WebWindows Collection Object


WebFile Object

 WebFolder Object


DispFPHTMLDocument Object
elementFromPoint Method


DispFPHTMLDocument Object
createStyleState Method


DispFPHTMLDocument Object
createStyleSheet Method


DispFPHTMLDocument Object


ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 NavigationNodes Collection Object

 Properties Collection Object

 WebEx Object

 WebFile Object

 WebFiles Collection Object

 WebFolder Object

 WebFolders Collection Object

 Webs Collection Object


DispFPHTMLDocument Object
createElement Method


WebFolder Object


NavigationNode Object

 WebFile Object

 WebFolder Object


DispFPHTMLDocument Object

 WebFile Object

 Webs Collection Object


Application Object
domain Property


OnAfterPageSave Event

 OnAfterPageWindowViewChange Event

 OnAfterWebPublish Event

 OnAfterWebWindowSubViewChange Event

 OnAfterWebWindowViewChange Event

 OnBeforePageSave Event

 OnBeforePageWindowViewChange Event

 OnBeforeWebPublish Event

 OnBeforeWebWindowSubViewChange Event

 OnBeforeWebWindowViewChange Event

 OnPageClose Event

 OnPageNew Event

 OnPageOpen Event

 OnPageWindowActivate Event

 OnRecalculateHyperlinks Event

 OnWebClose Event

 OnWebFileCheckOut Event

 OnWebNew Event

 OnWebOpen Event

 WindowActivate Event

 WindowDeactivate Event
LocatePage Method

 MakeAbs Method

 MakeRel Method

 OnTime Method

 ParseURL Method

 Quit Method

 Run Method
DispFPHTMLDocument Object

 System Object

 Themes Collection Object

 WebWindows Collection Object

 Webs Collection Object
ActiveDocument Property

 ActivePageWindow Property

 ActiveWeb Property

 ActiveWebWindow Property

 AnswerWizard Property

 Application Property

 Assistant Property

 Build Property

 COMAddIns Property

 CommandBars Property

 ConnectionSpeed Property

 FileDialog Property

 FileSearch Property

 LanguageSettings Property

 MonthsShown Property

 Name Property

 NewPageorWeb Property

 OlderFile Property

 OrganizationName Property

 ProductCode Property

 RecentFile Property

 ShowStartupDialog Property

 SlowPage Property

 System Property

 Themes Property

 UserName Property

 VBE Property

 Version Property

 WebWindows Property

 Webs Property


ApplyChanges Method
ListFields Collection

 WebFolder Object
Application Property

 DefaultViewPage Property

 Description Property

 DesignSecurity Property

 DisplayForm Property

 EditForm Property

 EditSecurity Property

 Fields Property

 Folder Property

 Name Property

 NewForm Property

 Parent Property

 ReadOnly Property

 ReadSecurity Property

 Type Property

 Web Property


Close Method

 Open Method

 clear Method

 createElement Method

 createStyleSheet Method

 createStyleState Method

 createUndoTransaction Method

 elementFromPoint Method

 execCommand Method

 queryCommandEnabled Method

 queryCommandIndeterm Method

 queryCommandState Method

 queryCommandSupported Method

 queryCommandText Method

 queryCommandValue Method

 toString Method
Application Object

 PageWindowEx Object
IsDirty Property

 Title Property

 Url Property

 ViewMode Property

 Web Property

 activeElement Property

 alinkColor Property

 all Property

 anchors Property

 applets Property

 bgColor Property

 body Property

 currentStyleState Property

 defaultCharset Property

 documentHTML Property

 domain Property

 embeds Property

 fgColor Property

 fileCreatedDate Property

 fileModifiedDate Property

 fileSize Property

 fileUpdatedDate Property

 forms Property

 frames Property

 hasSharedBorders Property

 htmlViewText Property

 ignoreSharedBorders Property

 images Property

 lastModified Property

 linkColor Property

 links Property

 location Property

 mimeType Property

 mseMode Property

 nameProp Property

 onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property

 onreadystatechange Property

 onselectstart Property

 pageContentElement Property

 parentWindow Property

 protocol Property

 readyState Property

 scripts Property

 selection Property

 styleSheets Property

 vlinkColor Property

 webbots Property


ApplyChanges Method
ListFields Collection

 WebFolder Object
Application Property

 DefaultViewPage Property

 Description Property

 DesignSecurity Property

 DisplayForm Property

 EditForm Property

 Fields Property

 FileDialogViewPage Property

 FileSaveForm Property

 Folder Property

 Name Property

 NewForm Property

 Parent Property

 ReadOnly Property

 Template Property

 Type Property

 Web Property


ApplyChanges Method
Lists Collection

 WebFolder Object
ListFields Collection

 WebFolder Object
Application Property

 DefaultViewPage Property

 Description Property

 DesignSecurity Property

 DisplayForm Property

 EditForm Property

 Fields Property

 Folder Property

 Name Property

 NewForm Property

 Parent Property

 ReadOnly Property

 Type Property

 Web Property


Delete Method


Application Property

 Choices Property

 DefaultValue Property

 Description Property

 DisplayFormat Property

 Name Property

 Parent Property

 ReadOnly Property

 Required Property

 Type Property

 Web Property


Delete Method
Application Property

 Currency Property

 DefaultValue Property

 Description Property

 DisplayFormat Property

 MaximumValue Property

 MinimumValue Property

 Name Property

 Parent Property

 ReadOnly Property

 Required Property

 Type Property

 Web Property


Delete Method
Application Property

 DefaultValue Property

 Description Property

 DisplayFormat Property

 Name Property

 Parent Property

 ReadOnly Property

 Required Property

 Type Property

 Web Property


Delete Method
ListField Object


Delete Method
Application Property

 DefaultValue Property

 Description Property

 Name Property

 NumberOfLines Property

 Parent Property

 ReadOnly Property

 Required Property

 Type Property

 Web Property


Delete Method
Application Property

 DefaultValue Property

 Description Property

 DisplayFormat Property

 MaximumValue Property

 MinimumValue Property

 Name Property

 Parent Property

 ReadOnly Property

 Required Property

 ShowAsPercentage Property

 Type Property

 Web Property


Add Method


Delete Method
Application Property

 DefaultValue Property

 Description Property

 MaxLength Property

 Name Property

 Parent Property

 ReadOnly Property

 Required Property

 Type Property

 Web Property


Add Method
WebEx Object


Application Property

 Count Property

 Item Property

 Parent Property


Move Method
NavigationNodes Collection Object

 WebEx Object

 WebFile Object
NavigationNodes Collection Object

 WebFile Object
Application Property

 Children Property

 File Property

 Home Property

 InNavBars Property

 IsLinkBar Property

 Label Property

 Next Property

 Parent Property

 Prev Property

 SubTree Property

 Url Property

 Web Property


Add Method

 AddLinkBar Method

 Delete Method
NavigationNode Object

 WebEx Object
Application Property

 Count Property

 Item Property

 Parent Property


ActiveDocument Property

 ActiveFrameWindow Property

 Application Property

 Caption Property

 Document Property

 File Property

 FrameWindow Property

 IsDirty Property

 Parent Property

 PreviewDocument Property

 ThemeProperties Property

 ViewMode Property

 Visible Property

 Web Property


Add Method

 Close Method
Application Property

 Count Property

 Item Property

 Parent Property


Add Method

 ApplyChanges Method

 Delete Method
WebEx Object

 WebFile Object

 WebFolder Object
Application Property

 Count Property

 Item Property

 Parent Property


ApplyChanges Method
ListFields Collection

 WebFolder Object
AllowMultipleResponses Property

 Application Property

 DefaultViewPage Property

 Description Property

 DesignSecurity Property

 DisplayForm Property

 EditForm Property

 EditSecurity Property

 Fields Property

 Folder Property

 Name Property

 NewForm Property

 Parent Property

 ReadOnly Property

 ReadSecurity Property

 ShowUserNamesInResults Property

 Type Property

 Web Property


Application Property

 Build Property

 HorizontalResolution Property

 LanguageDesignation Property

 OperatingSystem Property

 Parent Property

 ProfileString Property

 Version Property

 VerticalResolution Property


Application Property

 Format Property

 Label Property

 Name Property

 Parent Property

 Version Property


Application Object

 WebEx Object
Application Property

 Count Property

 Item Property

 Parent Property


Activate Method

 ApplyNavigationStructure Method

 ApplyTemplate Method

 ApplyTheme Method

 CancelRequests Method

 Close Method

 Delete Method

 LocateFile Method

 LocateFolder Method

 LocatePage Method

 Publish Method

 RecalcHyperlinks Method

 Refresh Method
Lists Collection

 NavigationNode Object

 NavigationNodes Collection Object

 Properties Collection Object

 Themes Collection Object

 WebFile Object

 WebFiles Collection Object

 WebFolder Object

 WebFolders Collection Object

 WebWindows Collection Object
ActiveWebWindow Property

 AllFiles Property

 AllFolders Property

 AllNavigationNodes Property

 AllowsLongFilenames Property

 Application Property

 HomeNavigationNode Property

 IsHiddenFoldersEnabled Property

 IsUnderRevisionControl Property

 Lists Property

 Parent Property

 Properties Property

 RevisionControlProject Property

 RootFolder Property

 RootNavigationNode Property

 SharedBorders Property

 ThemeProperties Property

 Themes Property

 Title Property

 Url Property

 WebWindows Property


Application Property

 CheckedoutBy Property

 Creator Property

 DownloadTime Property

 Extension Property

 IsOpen Property

 IsOrphan Property

 MetaTags Property

 Name Property

 NavigationNode Property

 Parent Property

 Properties Property

 SharedBorders Property

 ThemeProperties Property

 Title Property

 Url Property

 Web Property


Add Method

 ApplyTheme Method

 Delete Method
WebEx Object

 WebFolder Object
Application Property

 Count Property

 Item Property

 Parent Property


AllFiles Property

 AllFolders Property

 Application Property

 Files Property

 Folders Property

 IsExecutable Property

 IsReadable Property

 IsRoot Property

 IsWeb Property

 IsWritable Property

 List Property

 Name Property

 Parent Property

 Properties Property

 Url Property

 Web Property


Add Method

 Delete Method
WebEx Object

 WebFolder Object
Application Property

 Count Property

 Item Property

 Parent Property


Add Method

 Delete Method

 Open Method
Application Property

 Count Property

 Item Property

 Parent Property


ActivePageWindow Property

 Application Property

 Caption Property

 PageWindows Property

 Parent Property

 SelectedFiles Property

 SelectedFolders Property

 SubViewMode Property

 ViewMode Property

 ViewModeEx Property

 Visible Property

 Web Property


Add Method

 Close Method
Application Object

 WebEx Object
Application Property

 Count Property

 Item Property

 Parent Property


Application Object

 PageWindowEx Object


Application Object

 WebWindowEx Object


WebEx Object

 WebFolder Object
AllFolders Property

 AllNavigationNodes Property


WebEx Object

 WebFolder Object
AllFiles Property

 AllNavigationNodes Property


Survey Object


Application Object

 BasicList Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 ListFields Collection

 Lists Collection

 MetaTags Collection Object

 NavigationNode Object

 NavigationNodes Collection Object

 PageWindowEx Object

 PageWindows Collection Object

 Properties Collection Object

 Survey Object

 System Object

 Theme Object

 Themes Collection Object

 WebEx Object

 WebFile Object

 WebFiles Collection Object

 WebFolder Object

 WebFolders Collection Object

 WebWindowEx Object

 WebWindows Collection Object

 Webs Collection Object


Application Object

 System Object


PageWindowEx Object

 WebWindowEx Object


NavigationNode Object


Application Object
SlowPage Property


ListFields Collection

 Lists Collection

 MetaTags Collection Object

 NavigationNodes Collection Object

 PageWindows Collection Object

 Properties Collection Object

 Themes Collection Object

 WebFiles Collection Object

 WebFolders Collection Object

 WebWindows Collection Object

 Webs Collection Object


ListFieldCurrency Object


DispFPHTMLDocument Object
DispFPHTMLDocument Object


ListFieldChoice Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object
List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 ListFields Collection


BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object
BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object


BasicList Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 Survey Object
BasicList Object

 List Object

 List Property

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 ListFields Collection

 Lists Collection

 Survey Object


BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object
BasicList Object

 DocumentLibrary Object

 EditSecurity Property

 List Object

 Survey Object


BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object


ListFieldChoice Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldNumber Object

 ListFieldURL Object
AddChoice Method

 Choices Property

 RemoveChoice Method


DispFPHTMLDocument Object
defaultCharset Property


BasicList Object

 Survey Object


DispFPHTMLDocument Object
AllFiles Property

 AllFolders Property

 AllNavigationNodes Property

 Fields Property

 all Property

 anchors Property

 applets Property

 images Property

 links Property

 webbots Property


BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object
AllFiles Property

 AllFolders Property

 AllNavigationNodes Property

 all Property

 anchors Property

 applets Property

 embeds Property


NavigationNode Object

 PageWindowEx Object


DispFPHTMLDocument Object
fileUpdatedDate Property


DocumentLibrary Object


DispFPHTMLDocument Object
fileModifiedDate Property


BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object
DocumentLibrary Object

 List Object

 Survey Object


Theme Object


DispFPHTMLDocument Object
ignoreSharedBorders Property


System Object


DispFPHTMLDocument Object
hasSharedBorders Property


DispFPHTMLDocument Object

 PageWindowEx Object


WebEx Object
Folders Property


NavigationNode Object

 Theme Object


DispFPHTMLDocument Object
domain Property


ListFieldLookup Object
Survey Object


MinimumValue Property


ListFieldSingleLine Object
MinimumValue Property


MaximumValue Property


Application Object

 BasicList Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 Survey Object

 Theme Object

 WebFile Object

 WebFolder Object


BasicList Object

 DocumentLibrary Object

 List Object

 Survey Object
FileDialogViewPage Property

 FileSaveForm Property


ListFieldMultiLine Object


Application Object
RecentFile Property


DispFPHTMLDocument Object
onafterupdate Property


DispFPHTMLDocument Object
ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onclick Property

 ondblclick Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
OnDeactivate Event

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondragstart Property

 onhelp Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmouseout Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseover Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseup Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property

 onselectstart Property


DispFPHTMLDocument Object
onafterupdate Property

 onbeforeupdate Property

 onclick Property

 ondblclick Property

 ondragstart Property

 onhelp Property

 onkeydown Property

 onkeypress Property

 onkeyup Property

 onmousedown Property

 onmousemove Property

 onmouseout Property

 onmouseover Property

 onmouseup Property

 onreadystatechange Property


BasicList Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 ListFields Collection

 Lists Collection

 MetaTags Collection Object

 NavigationNode Object

 NavigationNodes Collection Object

 PageWindowEx Object

 PageWindows Collection Object

 Properties Collection Object

 Survey Object

 System Object

 Theme Object

 Themes Collection Object

 WebEx Object

 WebFile Object

 WebFiles Collection Object

 WebFolder Object

 WebFolders Collection Object

 WebWindowEx Object

 WebWindows Collection Object

 Webs Collection Object


PageWindowEx Object
htmlViewText Property


WebEx Object

 WebFile Object

 WebFolder Object


BasicList Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 Survey Object
DefaultValue Property


EditSecurity Property


DispFPHTMLDocument Object
onreadystatechange Property


ListFieldChoice Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldURL Object


WebEx Object

 WebFile Object


ListFieldNumber Object


PageWindowEx Object

 WebEx Object

 WebFile Object


DispFPHTMLDocument Object

 WebEx Object

 WebFile Object


BasicList Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 Survey Object


DispFPHTMLDocument Object

 NavigationNode Object

 WebEx Object

 WebFile Object

 WebFolder Object


Application Object

 System Object

 Theme Object


DispFPHTMLDocument Object

 PageWindowEx Object

 WebWindowEx Object


WebWindowEx Object
ViewMode Property


DispFPHTMLDocument Object
alinkColor Property


BasicList Object

 DispFPHTMLDocument Object

 DocumentLibrary Object

 List Object

 ListField Object

 ListFieldChoice Object

 ListFieldComputed Object

 ListFieldCounter Object

 ListFieldCurrency Object

 ListFieldDateTime Object

 ListFieldFile Object

 ListFieldInteger Object

 ListFieldLookup Object

 ListFieldMultiLine Object

 ListFieldNumber Object

 ListFieldSingleLine Object

 ListFieldTrueFalse Object

 ListFieldURL Object

 NavigationNode Object

 PageWindowEx Object

 Survey Object

 WebFile Object

 WebFolder Object

 WebWindowEx Object


INDEX~TEXT
seealso~"See&nbsp;Also"
appliesto~"Applies&nbsp;To"
elements~"Elements"
properties~"Properties"
methods~"Methods"
events~"Events"
example~"Example"
specifics~"Specifics"
show~"Show&nbsp;description"
hide~"Hide&nbsp;description"