Share via


WebWindows Collection Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa190258.parchild(en-us,office.10).gifWebWindows

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 allWebWindowEx 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