You might want to check out the other events then. DocumentOpen,
NewDocument and WindowActivate might do what you need.

Signature
Tom Winter
tom@nospam.amosfivesix.com
> You might want to check out the other events then. DocumentOpen,
> NewDocument and WindowActivate might do what you need.
[quoted text clipped - 10 lines]
> >
> > Thanks
No we cannot, unfortunately.
In addition we have some macros from another company to integrate
tehir product with Word, and those macros are catching the
DocumentChange event, and they are firedd when not needed. since this
macros requires a connection to the DB, each time I update a doc
containing 30 fields, 30 DB connections are made one after the other,
slowing down Word to death
Tom Winter - 17 Feb 2005 14:17 GMT
>> You might want to check out the other events then. DocumentOpen,
>> NewDocument and WindowActivate might do what you need.
[quoted text clipped - 18 lines]
> containing 30 fields, 30 DB connections are made one after the other,
> slowing down Word to death
I assume you are not able to change the macros? If that's the case, there's
not much more I can help you with. I myself have never used the
DocumentChange event, so I'm not familiar with any problems related to it.

Signature
Tom Winter
tom@nospam.amosfivesix.com
Peter_A_M (NL) - 22 Feb 2005 10:09 GMT
For myself I'd try to work with a public variable as a "flag"
(e.g. declaration in module: Public FlagDBConnected as Boolean).
You could set this variable to True once your DB is connected so that your
code needs not try to do this anymore.
Remains the problem to decide when (& where & how) to set the variable to
False again.
Peter
Jean-Guy Marcil - 17 Feb 2005 16:55 GMT
gandalf was telling us:
gandalf nous racontait que :
>> You might want to check out the other events then. DocumentOpen,
>> NewDocument and WindowActivate might do what you need.
[quoted text clipped - 22 lines]
> containing 30 fields, 30 DB connections are made one after the other,
> slowing down Word to death
See Pete Benett's solution for something like this:
http://tinyurl.com/6rfuf
Also, according to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/wo
evtdocumentchange.asp
the document change event fires only in certain circumstances. If you get a
different behaviour, then it may be that the third party add-in you are
using was badly designed and doing things in the background that are not
visible but that meet with the criteria for firing a DocumentChange event.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
gandalf - 18 Feb 2005 13:28 GMT
> Also, according to
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/wo
evtdocumentchange.asp
> the document change event fires only in certain circumstances. If you get a
> different behaviour, then it may be that the third party add-in you are
> using was badly designed and doing things in the background that are not
> visible but that meet with the criteria for firing a DocumentChange event.
Forgot one thing: I don't have this problem with Word97, but only with
WordXP...
It must be a bug: why the DocumentChange event should fire when i
update the fields of a document?
Jean-Guy Marcil - 18 Feb 2005 16:22 GMT
gandalf was telling us:
gandalf nous racontait que :
>> Also, according to
>>
[quoted text clipped - 12 lines]
> It must be a bug: why the DocumentChange event should fire when i
> update the fields of a document?
I tested the DocumentChange event on Word XP and Word 2003.
It behaved exactly as it was supposed to. I inserted tables, deleted them,
opened/closed headers with/without fields, updated fields in headers/tables,
mailmerged, etc.
No problem.
This is why I suggested that either there is something in your code that you
have not considered that fires the event, or the third-party add-in is doing
stuff you do not know about (do you have access to the code?) or your
template is corrupt.
OTHO, I have not tested it with a DB connection.
If there is a bug, can you narrow it down and provide a step by step
procedure so that others can reproduce it?

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Michael Schmidt - 26 Feb 2005 01:08 GMT
> gandalf was telling us:
> gandalf nous racontait que :
[quoted text clipped - 31 lines]
> If there is a bug, can you narrow it down and provide a step by step
> procedure so that others can reproduce it?
Maybe the easiest thing is to include a workaround into the
Document_Change procedure:
Declare the sub as static or declare a variable on class level in
which you enter the Name of the document that caused the call of the
Document_Change sub. If it is the same as the time before, ignore the
event:
Public WithEvents MSWord As Application
Private Static Sub MSWord_DocumentChange()
Dim LastDoc As String
If ActiveDocument.Name = LastDoc Then
Exit Sub
Else
LastDoc = ActiveDocument.Name
End If
' Body of proc ...
End Sub