Word 97 and Word 2002 carriage return differences.

C

Chad

Hello,

I am a developer, and my application writes a file
intended for mail merge use. The field delimiter is a tab
and the record delimiter is a carriage return. The first
record is a header to define the fields.

This mail merge file works as a datasource in Word 95,
Word 97 and Word 2000. It does not work in Word 2002.

When I open the mail merge file for review in Word 2002
there is carriage return added to the last line in the
file. This carriage return does not appear when I open
the same file in Word 95, Word 97 or Word 2000.

It is this carriage return that Word 2002 adds that causes
the mail merge to fail when this file is used as a
datasource. If I manually remove the carriage return in
Word 2002 the mail merge is successful.

Any ideas on how I can solve this problem??

Thank you.

Chad
 
C

Cindy M -WordMVP-

Hi Chad,
I am a developer, and my application writes a file
intended for mail merge use. The field delimiter is a tab
and the record delimiter is a carriage return. The first
record is a header to define the fields.
What ANSI character(s) are you using to create the carriage
return?

In what way is the merge failing (error)? What file extension
are you using for the data file name? And is your code
linking in the data source, or just opening a document
already linked to the data source? If the first, please show
us the OpenDataSource method you're using.
This mail merge file works as a datasource in Word 95,
Word 97 and Word 2000. It does not work in Word 2002.

When I open the mail merge file for review in Word 2002
there is carriage return added to the last line in the
file. This carriage return does not appear when I open
the same file in Word 95, Word 97 or Word 2000.

It is this carriage return that Word 2002 adds that causes
the mail merge to fail when this file is used as a
datasource. If I manually remove the carriage return in
Word 2002 the mail merge is successful.

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 :)
 
C

Chad

Hello Cindy,

Thank you for taking the time to look at my posting.

I use a fwrite statement in my C++ code, that contains
a "/15".

The error I get is "Word could not merge the main document
with the data source because the data records were empty
or no data records matched your query options."

My application creates a "lease.doc" file. I have tried
a .prn and .txt extension.

My application creates a file, there is no linking done to
word. The user then opens word and uses the file as the
datasource when doing a mail merge.

Chad
 
C

Cindy M -WordMVP-

Hi Chad,

thanks for the additional information.
I use a fwrite statement in my C++ code, that contains
a "/15".
I'm not familiar with C++, so I don't know what ANSI
character code /15 corresponds to? But Word wants/expects
Chr$(13), and will sometimes balk if it gets a "standard"
Chr$(10)Chr$(13) (newline, carriage return). Does that
translate to anything meaningful for you?
The error I get is "Word could not merge the main document
with the data source because the data records were empty
or no data records matched your query options."

My application creates a "lease.doc" file. I have tried
a .prn and .txt extension.

My application creates a file, there is no linking done to
word. The user then opens word and uses the file as the
datasource when doing a mail merge.

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 :)
 
C

Chad

Cindy,

Thank you. I will explore this idea.

Something changed in word 2002, the "\15" works in all
previous versions of word.

Chad
 
C

Cindy M -WordMVP-

Hi Chad,
Something changed in word 2002, the "\15" works in all
previous versions of word.
Yes, it did. Unfortunately, I'm not exactly sure what
changed, as it would relate to what you're doing.

Word's default connection method is now OLE DB. And as best
I've been able to determine, it's more "forgiving" about
Chr$(13) vs. Chr$(10)Chr$(13) than earlier versions were...

And this is why I asked you to try with different
extentions on the file name. If OLE DB provider doesn't
recognize something as a text file, Word's internal text
converter should kick in, and that should behave as earlier
versions.

The only other possibility would be that you were using an
ODBC connection up until now, and the ODBC driver just
happened to be the only one recognizing this character. One
other thing you could try would be to activate "Confirm
conversions on open" in Tools/Options/General. Then you'll
be able to specify the connection method after choosing the
file. At this point, ODBC probably won't be listed, so
activate "Show all". you should then be able to choose the
Text ODBC driver and test whether that does give you the
result you remember.

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