OnWebNew Event

Microsoft FrontPage Visual Basic

Occurs when a new Web site is created.

Private Sub expression_OnWebNew(ByVal pWeb As Web)

expression The variable name that references an object of type Application declared using the WithEvents keyword in a class module.

pWeb    Required WebEx. A WebEx object.

Remarks

The OnWebNew event is associated with the Application object. When the user creates a new Web site in Microsoft FrontPage, the OnWebNew event fires and executes the code within the event procedure.

Example

The following example creates a temporary Web site and adds a new file.

Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdCreateWeb, and a button called cmdCancel. Add the following code to the form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx

		
Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub

		
Private Sub cmdCreateWeb_Click()
    Webs.Add ("C:/My Documents/My Web Sites/TempWeb")
End Sub

		
Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub

		
Private Sub eFPApplication_OnWebNew(ByVal pWeb As Web)
    Dim myFile As WebFile

    Set myFile = pWeb.RootFolder.Files.Add("index.htm")
    myFile.Open
End Sub