WebEx Object



Represents a Microsoft FrontPage Web site. The WebEx object is a member of the Webs collection, which represents all of the open Web sites in FrontPage. 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 site’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 ordinal position of a Web site in the Webs collection, to return a single WebEx object. The following example returns the URL of the first Web site 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 Microsoft Visual Basic for Applications (VBA), 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, see 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 site 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 site. The RootNavigationNode object is created by default when you create a Web site, 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 site. 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 site either on or off. The following statement sets the SharedBorders property to True and turns shared borders on for the specified Web site.
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 site; 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 site, where the variable for the Adventure Works Web site 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 site, with webAdventureWorksWeb
as the Web object 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 site. The following example locates a folder for a disk-based Web site.
Application.Web.LocateFolder("C:\My Web Sites\Adventure Works\images")
Use the Publish method to publish a Web site to a Web server. The following statement publishes the Adventure Works Web site 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