WebWindows Collection
Multiple objects
![]() ![]() ![]() ![]() ![]() ![]() |
A collection of WebWindowEx objects. Each WebWindow object represents an open Web site 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 FrontPage. 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 |
|
Close multiple WebWindowEx objects in the application (as shown in the previous example) |
|
Close all WebWindowEx objects in the application |
|
Close an individual WebWindowEx object in a Web site |
|
Close multiple WebWindowEx objects in a Web site |
|
Close a collection in a Web site |
|
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