OnAfterWebPublish Event

Microsoft FrontPage Visual Basic

Occurs after a Web site is published.

Private Sub expression_OnAfterWebPublish(ByVal pWeb As WebEx, Success As Boolean)

expression     A variable name which references an object in the Applies To list declared using the WithEvents keyword in a class module.

pWeb    Required WebEx. The specified WebEx object.

Success    Required Boolean. True if the specified Web was successfully published.

Remarks

The OnAfterWebPublish event is associated with the Application object. After the user publishes a Web site in Microsoft FrontPage, the OnAfterWebPublish event fires and executes the code that you specified within the event procedure.

Example

The following example creates a property called "Published" with the value of True after a Web site has been published.

Note  To run this example you must have one Web site open. This example uses a Web site called Rogue Cellars. You can create a Web site called Rogue Cellars, or you can substitute a Web site of your choice in the following code sample.

Create a form called frmLaunchEvents.frm and add two command buttons, a button called cmdPublishWeb, and a button called cmdCancel. Then 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 cmdPublishWeb_Click()
    ActiveWeb.Publish "C:\My Documents\My Web Sites\Rogue Cellars"
End Sub

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

		
Private Sub eFPApplication_OnAfterWebPublish(ByVal pWeb As WebEx, Success As Boolean)
    If Success = True Then
        pWeb.Properties.Add "Published", True
        pWeb.Properties.ApplyChanges
    Else
        MsgBox "There was a problem publishing your " & pWeb & " web."
    End If
End Sub