I would expect so but not having the book you reference I'm not exactly sure
what Ken et al are doing there.
So in answer to your original questions then:-
I don't see why it would be a coincidence.
No there is no other work required.
To expand
----------------
All you should need to do is
1) establish a reference to Microsoft Word
2) create a class module and declare a variable of type Word.Application
with the Withevents keyword
3) drop the lefthand combo at the top of the window and find your
Word.Application variable in there
4) then pick off the events you want to sink from the right hand combo.
The declarations should then be correct.
Check that argument references to things like Document are disambiguated in
the procedure declaration (e.g. var as Word.Document not var as Document)
and you should be away.
Sample:
------------
Option Explicit
Private WithEvents waVar As Word.Application
' ***************************************
'
Private Sub waVar_DocumentBeforeClose( _
ByVal Doc As Word.Document, _
Cancel As Boolean _
)
'
End Sub
Private Sub waVar_DocumentBeforePrint( _
ByVal Doc As Word.Document, _
Cancel As Boolean _
)
'
End Sub
Private Sub waVar_DocumentBeforeSave( _
ByVal Doc As Word.Document, _
SaveAsUI As Boolean, _
Cancel As Boolean _
)
'
End Sub
Private Sub waVar_DocumentChange()
'
End Sub
Private Sub waVar_DocumentOpen( _
ByVal Doc As Word.Document _
)
'
End Sub
Private Sub waVar_Quit()
'
End Sub
--
Terry Kreft
MVP Microsoft Access
"astro" <as*********@mn.rr.com> wrote in message
news:b2******************@twister.rdc-kc.rr.com...
yes - wouldn't the example event sinks ("_quit" and "_documentchange")
fail if this was not so?
thanks )
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:R4********************@karoo.co.uk...
Do you have a reference to Microsoft Word?
--
Terry Kreft
MVP Microsoft Access
"astro" <as*********@mn.rr.com> wrote in message
news:Ov******************@twister.rdc-kc.rr.com... I've been looking at the event sinking example in Litwin et. al.
"Access 97 Developer's Handbook" and I am able to event sink the 2 events
listed - those being the "_quit" and "_documentchange" events described and
coded for in the examples mdb file..
However - some other important events I cannot get to work - some
are:
DocumentBeforeClose
DocumentBeforePrint
DocumentBeforeSave
DocumentOpen
etc............
The error I get is: "procedure declaration does not match description
of event or procedure having the same name"
All of these other events have word object types (eg 'document',
'section') passed as arguements. Is it just a coincidence that the only 2 events
coded for do not have any arguements or is there some additional work
necessary to tap into these events that was not discussed in the text?
Thanks