Occurs when a Web site is opened.
Private Sub expression_OnWebOpen(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 OnWebOpen event is associated with the Application object. When the user opens a Web site in Microsoft FrontPage, the OnWebOpen event fires and executes the code that you specified within the event procedure.
Example
The following example opens the Index.htm file when a Web site is opened.
Note This example uses Rogue Cellars as the specified Web site to be opened. You can create a Web site called Rogue Cellars or you can substitute a Web site of your choice.
Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdOpenWeb,
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 cmdOpenWeb_Click()
Webs.Open ("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_OnWebOpen(ByVal pWeb As Web)
Dim myFile As WebFile
Set myFile = pWeb.RootFolder.Files.Add("index.htm")
myFile.Open
End Sub