-----Original Message-----
Jon,
In your class module, you would do the following:
--------------------
Dim WithEvents fpApp As FrontPage.Application
Private Sub Class_Initialize()
Set fpApp = FrontPage.Application
End Sub
Private Sub fpApp_OnPageOpen(ByVal pPage As PageWindow)
MsgBox pPage.ActiveDocument.Url
End Sub
--------------------
What you have here is a class-level variable (fpApp) that contains a
reference to the FrontPage application. You then have the code in
Class_Initialize (which runs when a new instance of the class is created)
that simply sets the fpApp variable equal to the current instance of
FrontPage. Next you have the code that represents the OnPageOpen event. In
this case, I just display the URL of the document.
Now you need a user module that you will call from the Macros dialog. This
user module will simply instantiate a new instance of your class. Before I
do that, I rename my class from Class1 (the default) to something more
informative to me. In this case, I renamed it PageOpenMessage.
Here is the code in my user module:
-------------------------------
Dim poMsg As PageOpenMessage
Public Sub hookEvents()
Set poMsg = New PageOpenMessage
End Sub
-------------------------------
This code defines a variable (poMsg) that will contain an instance of my
PageOpenMessage class. It is defined at the module level outside of any sub
procedures so that it will work for the life of my app. The hookEvents sub
procedure is the procedure that shows up in the macros dialog, and it is the
macro that you will run. When you run it, it simply creates a new instance
of PageOpenMessage, and that instance is assigned to the poMsg variable.
That's all there is to it. Open Tools, Macros, Macro and run the hookEvents
macro to get going.
--
Jim Cheshire
Jimco Add-ins
http://www.jimcoaddins.com
===================================
Co-author of Special Edition
Using Microsoft FrontPage 2003
===================================
Our newest add-in:
FrontPage Cart Companion
http://www.frontpagecartcompanion.com
.