Crash on a doc close based on a specific dot

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 !
 
W

Word Heretic

G'day natric <[email protected]>,

The doc close instructions art giving thou grief.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


natric reckoned:
 
J

Jean-Guy Marcil

natric was telling us:
natric nous racontait que :
[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 :

See my message in the microsoft.public.fr.word group.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
W

Word Heretic

G'day natric <[email protected]>,

If you don't provide code samples, how the hell am I supposed to guess
what the problem is mate?

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


natric reckoned:
[Posted to microsoft.public.word.vba.general, copy sent to author]

G'day natric <[email protected]>,

The doc close instructions art giving thou grief.

What a wondeful help
 
N

natric

[Posted to microsoft.public.word.vba.general, copy sent to author]

G'day natric <[email protected]>,

If you don't provide code samples, how the hell am I supposed to guess
what the problem is mate?

Steve Hudson - Word Heretic

All code is provided in my initial post. And, more, as said in this same
post, I can send you the two minimum files which reproduce the Word
crash. Just copy/paste code in original post or ask .zip by email :)
 
N

natric

[Posted to microsoft.public.word.vba.general, copy sent to author]

no- said:
natric was telling us:
natric nous racontait que :
[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 :

See my message in the microsoft.public.fr.word group.

J'y vais de ce pas :)
 
W

Word Heretic

G'day natric <[email protected]>,

If there is nothing in that document close event, get rid of it
entirely :)

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


natric reckoned:
[Posted to microsoft.public.word.vba.general, copy sent to author]

G'day natric <[email protected]>,

If you don't provide code samples, how the hell am I supposed to guess
what the problem is mate?

Steve Hudson - Word Heretic

All code is provided in my initial post. And, more, as said in this same
post, I can send you the two minimum files which reproduce the Word
crash. Just copy/paste code in original post or ask .zip by email :)
 
N

natric

[Posted to microsoft.public.word.vba.general, copy sent to author]

G'day natric <[email protected]>,

If there is nothing in that document close event, get rid of it
entirely :)

No, in this example, there was nothing in close event handler just to
show it doesn't depend of the handler content... However, now, it seems
the responsible be found : maybe something around ActiveX use (see the
rest of this thread and the Jean-Guy post + the equivalent thread in the
equivalent French ng).
 
W

Word Heretic

G'day natric <[email protected]>,

Fair 'nuff - I avoid ActiveX controls for a few reasons. Can't help
you there :)

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


natric reckoned:
[Posted to microsoft.public.word.vba.general, copy sent to author]

G'day natric <[email protected]>,

If there is nothing in that document close event, get rid of it
entirely :)

No, in this example, there was nothing in close event handler just to
show it doesn't depend of the handler content... However, now, it seems
the responsible be found : maybe something around ActiveX use (see the
rest of this thread and the Jean-Guy post + the equivalent thread in the
equivalent French ng).
 
N

natric

[Posted to microsoft.public.word.vba.general, copy sent to author]


Don't worry, problem being encircled is close to be solved ;) Thanks for
your interest.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top