Represents a window that is opened on a Microsoft FrontPage-based web. The WebWindow 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 WebWindow objects are indexed beginning with zero. Each web that is opened in FrontPage is contained in a new WebWindow object, unless it is opened in a windowless environment by setting the Visible property of the WebWindow 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 WebWindow object. You can also use the PageWindows property to return information about the collection of open pages in a WebWindow object. The following example sets the WebWindow object to the active web window, and then returns the file names and dates that the files were last modified for the collection of open PageWindows objects within the WebWindow object.
Note To run this example, create a form with a command button called cmdWebWindowDisplay
and a text box called txtWebWindowDisplay
. You must have more than one page window open to display the iteration.
Private sub cmdWebWindowDisplay_Click()
On Error Resume Next
Dim openWebWindow As WebWindow
Dim openPageWindows As PageWindows
Dim thisPage As PageWindow
Dim CRLF As String
Dim myText As String
Set openWebWindow = Application.ActiveWebWindow
Set openPageWindows = openWebWindow.PageWindows
txtWebWindowDisplay.MaxLength = 1000
txtWebWindowDisplay.MultiLine = True
txtWebWindowDisplay.WordWrap = True
CRLF = Chr(13) & Chr(10)
With openWebWindow
For Each thisPage in openPageWindows
With thisPage
myText = myText & "Open Page: " & .Caption _
& CRLF & "Page Last Modified: " _
& thisPage.Document.fileModifiedDate & CRLF & CRLF
End With
Next
txtWebWindowDisplay.Text = myText
End With
End Sub
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 WebWindow 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 ActivePageWindow object. The following statements return the URL and the caption of the ActivePageWindow 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 WebWindow 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 WebWindow object, such as "Microsoft FrontPage – C:\MyWebs\Adventure Works". The following statement returns the value of the Caption property of the WebWindow object.
thisCaption = WebWindow.Caption
Use the Close method to close a WebWindow object. The following statement closes the specified WebWindow.
Set myWebWindowOne = WebWindows(0)
myWebWindowOne.Close
You can use the SelectedFiles and SelectedFolders properties to access selected objects within a WebWindow object. The following example returns the file names of selected files in each open web window.
Note To run this example, create a form with a command button called cmdSelectedFiles
and a text box called txtSelFileDisplay
. You must have more than one open web window with a selected file in each web window.
Private Sub cmdSelectedFiles_Click()
Dim myWebWindows As WebWindows
Dim myWebWindow As WebWindow
Dim mySelFiles As Variant
Dim mySelFile As WebFile
Dim mySelName As String
Dim myCount As Integer
Set myWebWindows = WebWindows
txtSelFileDisplay.maxLength = 1000
txtSelFileDisplay.MultiLine = True
txtSelFileDisplay.WordWrap = True
mySelName = "Selected Files: "
For Each myWebWindow In myWebWindows
mySelFiles = myWebWindow.SelectedFiles
For myCount = 0 To UBound(mySelFiles)
Set mySelFile = mySelFiles(myCount)
mySelName = mySelName & " " & mySelFile.Name
txtSelFileDisplay.Text = mySelName & vbCrLf
Next
Next
End Sub
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 WebWindow object. The Visible property returns True if a WebWindow object is visible. The following statement sets a WebWindow object to an invisible state.
WebWindow.Visible = False
Use the Web property to return information about the Web object. The following statement returns the number of properties for the specified web.
myProperties = ActiveWeb.WebWindows(0).Web.Properties.Count