Strange Crash in Word XP or 2003

S

Scott McBurney

I've got a strange situation I'm running into using Word XP, and 2003 appears
to have a similar problem.

We have a VBA macro that uses a custom COM object to export a CSV file from
another application.

The macro then goes on to associate the CSV file to the current document and
set it up for a mail merge, leaving the user in the Word XP mail merge wizard.

If the user inserts a field that contains multiple lines (such as the
address block) and then chooses to peform the mail merge to a new document,
all works well. The macro terminates and everyone is happy.

However, when the user closes the new document and closes the original merge
document, thats when Word throws an error:

"The instruction at "0x73489dee" referenced memory at "0x09006e8c". The
memory could not be read."

Any clue as to whats up here? If the mail merge contains fields that have
only a single line of data (such as first name, last name), this doesn't
happen. If the macro doesn't use our COM objects to perform an export, and
instead uses an existing CSV file, this doesn't happen either.

I'm quite perplexed.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?U2NvdHQgTWNCdXJuZXk=?=,

New one on me. could you show us the code involved in automating Word and
setting up the mailmerge, etc. please? And this is happening on multiple
machine, not just one?

Ah, one thought does occur to me: what ASCII character is used to define the new
lines in the text file. Perhaps it's a character Word can't "swallow"?
I've got a strange situation I'm running into using Word XP, and 2003 appears
to have a similar problem.

We have a VBA macro that uses a custom COM object to export a CSV file from
another application.

The macro then goes on to associate the CSV file to the current document and
set it up for a mail merge, leaving the user in the Word XP mail merge wizard.

If the user inserts a field that contains multiple lines (such as the
address block) and then chooses to peform the mail merge to a new document,
all works well. The macro terminates and everyone is happy.

However, when the user closes the new document and closes the original merge
document, thats when Word throws an error:

"The instruction at "0x73489dee" referenced memory at "0x09006e8c". The
memory could not be read."

Any clue as to whats up here? If the mail merge contains fields that have
only a single line of data (such as first name, last name), this doesn't
happen. If the macro doesn't use our COM objects to perform an export, and
instead uses an existing CSV file, this doesn't happen either.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
S

Scott McBurney

Thanks for the reply. I have been doing more research on this, and found
some interesting things.

1. If you don't use our custom objects (written in VB6) to perform the
export to CSV, and the macro just runs using an existing CSV file, then
everything works fine. Multi line fields have no problem and word exits
gracefully.

2. I wrote an ActiveX EXE server to perform the export in a separate
process, and called this from the Word Macro, and everything is fine too.

3. Every field in the csv file is enclosed in quotes, and separated with a
comma. Multi line fields use only a LF character to separate lines, and
there is no problem doing the merge using multi line fields.

4. The macro code that performs the merge was originally recorded by
manually performing a merge, so there is nothing unusual in there.

It is definitely an obscure situation when this happens, but for our
customers it is very commonplace. And without installing all of our
software, this appears to be impossible to recreate.

Since the crash only happens when the instance of Word is shutting down, I'm
guessing there is some unusual problem where it may be trying to free memory
that was already freed.

-Scott
 
S

Scott McBurney

I think I have found the problem.

The COM Objects that perform the export to CSV format, among other things
display a progress dialog while the export is happening.

The progress dialog was not "unloaded" after being used. Once I added an
unload statement for the form, all seems to be well now. I'm not sure why
Word was choking later on because of this, but it seems to fix it.

-Scott
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?U2NvdHQgTWNCdXJuZXk=?=,
The progress dialog was not "unloaded" after being used. Once I added an
unload statement for the form, all seems to be well now. I'm not sure why
Word was choking later on because of this, but it seems to fix it.
Glad you found it, and thanks for keeping us up-to-date :)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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