N
natric
[Posted to microsoft.public.word.vba.general, copy sent to author]
Hi all,
I have a problem with vba code using Word97. A document (say essai.doc)
being attached to a template (say base.dot) crashes Word everytime when
I'm closing it. To reproduce the things, I've created a minimum set of
dot/doc files which I'll describe to you here :
- essai.doc is an empty document, just attached to base.dot.
- base.dot only contains a combo-box in its body, plus some vba code :
.in ThisDocument :
Private Sub Document_Open()
DocOpenHelper
End Sub
Private Sub Document_Close()
'any instructions
End Sub
.in a module called Module1:
Function DocOpenHelper()
If ActiveDocument.Name = "base.dot" Then
MsgBox "Not a doc"
End If
End Function
That's all. With that, when I open, then close base.dot, all sounds
right. But, if I open essai.doc, then attempt to close-it, I
immediately, and all the times, obtain a winword.exe crash (Word 97 SR2
under Win2K Pro FR SP4) with the fatal error (translated from French)
"The instruction at '0x651ff21a' use the memory address '0x0000002c'.
The memory cannot be 'read'."
If I remove at least one of the private sub in ThisDocument OR remove
the only one function in Module1 OR delete the combo-box in the dot's
body, magically, it doesn't crash any more.
If I change the DocOpenHelper() content with some unuseful thing like
"x=1", it works too. In another way, if I reduce the original piece of
code with something which still continue to use some Word object, like
"MsgBox ActiveDocument.AttachedTemplate.Name", it crashes again during
doc closing (never during opening).
From this point, knowing I can't go without the current "elements"
(events handlers, fct helper, combo-box), I would like to identify
what's going wrong in DocOpenHelper() to foresee how to workaround the
Word crash.
Also, what's trouble me is that a piece of code which is executed at the
essai.doc opening generates a crash during the closing time, and this
even if Document_Close() is empty (just to show the minimum case which
still reproduce the problem).
Well ! Does this has a sense in your mind ? Of course, I'm able to send
these two files in a zip (34KB) to whom would like to try it in real
under Word 97 (don't know in others Word releases).
Ouups !
Hi all,
I have a problem with vba code using Word97. A document (say essai.doc)
being attached to a template (say base.dot) crashes Word everytime when
I'm closing it. To reproduce the things, I've created a minimum set of
dot/doc files which I'll describe to you here :
- essai.doc is an empty document, just attached to base.dot.
- base.dot only contains a combo-box in its body, plus some vba code :
.in ThisDocument :
Private Sub Document_Open()
DocOpenHelper
End Sub
Private Sub Document_Close()
'any instructions
End Sub
.in a module called Module1:
Function DocOpenHelper()
If ActiveDocument.Name = "base.dot" Then
MsgBox "Not a doc"
End If
End Function
That's all. With that, when I open, then close base.dot, all sounds
right. But, if I open essai.doc, then attempt to close-it, I
immediately, and all the times, obtain a winword.exe crash (Word 97 SR2
under Win2K Pro FR SP4) with the fatal error (translated from French)
"The instruction at '0x651ff21a' use the memory address '0x0000002c'.
The memory cannot be 'read'."
If I remove at least one of the private sub in ThisDocument OR remove
the only one function in Module1 OR delete the combo-box in the dot's
body, magically, it doesn't crash any more.
If I change the DocOpenHelper() content with some unuseful thing like
"x=1", it works too. In another way, if I reduce the original piece of
code with something which still continue to use some Word object, like
"MsgBox ActiveDocument.AttachedTemplate.Name", it crashes again during
doc closing (never during opening).
From this point, knowing I can't go without the current "elements"
(events handlers, fct helper, combo-box), I would like to identify
what's going wrong in DocOpenHelper() to foresee how to workaround the
Word crash.
Also, what's trouble me is that a piece of code which is executed at the
essai.doc opening generates a crash during the closing time, and this
even if Document_Close() is empty (just to show the minimum case which
still reproduce the problem).
Well ! Does this has a sense in your mind ? Of course, I'm able to send
these two files in a zip (34KB) to whom would like to try it in real
under Word 97 (don't know in others Word releases).
Ouups !