Found the problem.
Dim X As New EventsClassModule
needed to be at the module level.
Conceptually, a better way to code this is to put the application assignment
in the object's Initialize event --
Private WithEvents mWordApp
Private Sub Class_Initialize()
Set mWordApp = Word.Application
End Sub
Private Sub mWordApp_DocumentBeforeSave() ..
In this particular case it makes no difference to your overall project; but
the principle is that class objects should be self-contained as far as
possible: the calling code shouldn't need to know the details of
initialising the object. It also means you can keep the application
reference private -- you maybe need to make it public for other reasons, but
if not, private makes for more robust code.
It's also unwise to declare class modules using 'as new'. Consider this
sequence --
Dim X As New EventsClassModule
Set X = nothing
If X is nothing then .... 'This line will create a new instance of
the object
> Found the problem.
>
[quoted text clipped - 31 lines]
>>
>> Nothing happens when I open the document and then save it.
Greg Maxey - 24 Aug 2006 00:25 GMT
Thanks Jezebel for the explanation and example.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Conceptually, a better way to code this is to put the application
> assignment in the object's Initialize event --
[quoted text clipped - 58 lines]
>>>
>>> Nothing happens when I open the document and then save it.
Greg Maxey - 24 Aug 2006 01:07 GMT
Jezebel,
I obviously just can't grasp class modules.
I put this in the class module and nothing happens when I try to save:
Option Explicit
Private WithEvents mWordApp As Word.Appilication
Private Sub Class_Initialize()
Set mWordApp = Word.Application
End Sub
Private Sub mWordApp_DocumentBeforeSave()
MsgBox "Test"
End Sub
What am I supposed to code in the project module to enable this to work?
Thanks.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Conceptually, a better way to code this is to put the application
> assignment in the object's Initialize event --
[quoted text clipped - 58 lines]
>>>
>>> Nothing happens when I open the document and then save it.
Jezebel - 24 Aug 2006 01:24 GMT
Yout still have to instantiate the class object in your AutoNew or
wherever --
Ordinary module --
Dim mclsEvents as EventsClassModule
Sub SomethingOrOther()
Set mclsEvents = new EventsClassModule
End Sub
Bear in mind that the object gets zapped whenever your project is reset,
which includes whenever you edit any code.
> Jezebel,
>
[quoted text clipped - 77 lines]
>>>>
>>>> Nothing happens when I open the document and then save it.
Greg Maxey - 24 Aug 2006 01:23 GMT
Jezebel,
I have scratched together something that seems to work, but not sure if I
understand your comments about "NEW"
If have this is the project module:
Option Explicit
Dim X As myClass
Sub CallClass()
Set X = New myClass
End Sub
And this in the class module:
Option Explicit
Private WithEvents mWordApp As Word.Application
Private Sub Class_Initialize()
Set mWordApp = Word.Application
End Sub
Private Sub mWordApp_DocumentBeforeSave(ByVal Doc As Document, _
SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Test"
End Sub
Is this correct?

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Conceptually, a better way to code this is to put the application
> assignment in the object's Initialize event --
[quoted text clipped - 58 lines]
>>>
>>> Nothing happens when I open the document and then save it.
Jezebel - 24 Aug 2006 01:32 GMT
Yep, that's the way to do it.
> Jezebel,
>
[quoted text clipped - 84 lines]
>>>>
>>>> Nothing happens when I open the document and then save it.
Greg Maxey - 24 Aug 2006 02:15 GMT
Ok thanks. I will try to remember.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Yep, that's the way to do it.
>
[quoted text clipped - 92 lines]
>>>>>
>>>>> Nothing happens when I open the document and then save it.