WebEx Object

         
Webs
WebEx
Multiple objects

Represents a Microsoft FrontPage web. The WebEx object is a member of the Webs collection, which represents all of the open webs in a Web site. 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’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 index number of a web item, to return a single WebEx object. The following example returns the URL of the first web item 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 Visual Basic for Applications, 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, refer to 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 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. The RootNavigationNode object is created by default when you create a Web, 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. 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 either on or off. The following statement sets the SharedBorders property to True and turns shared borders on for the specified web.

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; 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, where the variable for the Adventure Works web 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, with webAdventureWorksWeb as the web 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. The following example locates a folder for a disk-based web.

Application.Web.LocateFolder("C:\My Webs\Adventure Works\images")

Use the Publish method to publish a web to a Web server. The following statement publishes the Adventure Works web 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