WebWindow Object

Represents a window in which a Web site is opened.


The WebWindow object is a member of the WebWindows collection. The WebWindows collection represents all of the open application windows in a specified Web site or within Office SharePoint Designer. Within the WebWindows collection, individual WebWindow objects are indexed beginning with zero. Each Web site that is opened in Office SharePoint Designer 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.

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. Use WebWindows(Index), where Index is the index number of an application window item, to return a single WebWindow object. The following statement returns the ViewMode property of the first Web site in the WebWindows collection.

Visual Basic for Applications
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 Navigation view.

Visual Basic for Applications
ActiveWebWindow.ViewMode = fpWebViewStructure

The Activate method puts the focus on the specified WebWindow object. The following statements activates the first Web site in the collection of open windows.

Visual Basic for Applications
myWebWindow = WebWindows(0)

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

Visual Basic for Applications
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 Office SharePoint Designer application window, which consists of the application name and the URL of the specified WebWindow object. The following statement returns the value of the Caption property of the WebWindow object.

Visual Basic for Applications
thisCaption = WebWindow.Caption

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

Visual Basic for Applications
Set myWebWindowOne = WebWindows(0)

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 Office SharePoint Designer.

Enumerated ConstantValueCorresponding View in Office SharePoint Designer
FpWebViewLinks0Hyperlinks view
FpWebViewFolders1Folders view
FpWebViewStructure2Navigation view
FpWebViewPage3Page view
fpWebViewAllFiles4A list of every file in Reports view
FpWebViewTodo5To Do list in Tasks view
FpWebViewBrokenLinks6A list of broken hyperlinks in Reports view
FpWebFiewSiteSummary7Site Summary view in Reports view

The following statement sets the ViewMode property to fpWebViewPage.

Visual Basic for Applications
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.

Visual Basic for Applications
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 sites.

Visual Basic for Applications
myProperties = ActiveWeb.WebWindows(0).Web.Properties.Count

Community Additions