View Single Post
  #6   Report Post  
Peter Jamieson
 
Posts: n/a
Default

In my experience, which is not particularly strong in this area, the only
way you will get this to work is to double up your quotes and surround the
string by quotes. As long as Word opens your text file using its text
converter and not ODBC then that also has the bonus of allowing you to use
multiline text and tabs (i.e. your field delimiter character) within your
text fields.

In other words, if your data contains

text1tabinches"tabminutes"tabother text

try

"text1"tab"inches"""tab"minutes"""tab"ot her text"

I do not think you have to quote the fields that do not contain
double-quotes but I do not think it does any harm either.

One problem is whether Word uses ODBC to read your text file or not.
Although it may be possible to issue an OpenDataSource command that
definitely does not use ODBC (or OLEDB for that matter)
a. you have already said that you do not have control over that part of the
process
b. I am not sure it is possible, at least in Word 2000.

Another problem may well be that the data in the file is sufficiently
complicated that Word ends up displaying its delimiter dialog box anyway,
which obviously screws up any automated process.

Peter Jamieson

"Ross" wrote in message
...
Cindy,

Sorry for the delay in responding but it seems that every time I try and
get
to this site it is unavailable - for weeks at a time!

This is a regular process that runs from a non-windows database. It writes
the information to the tab delimited file and then initiates the Word
document and prints it. This is a fully automated process and I do not see
how I could automate writing the record, running Excel, saving as an Excel
document and then running Word using the Excel file as the datasource.

I have tried creating the datasource with single quotes and it made no
difference to word. Excel reads it just fine.

This problem has been around since at least Word97 and it is a right royal
pain in the rectum.

I need a method of writing the datasource (I have FULL control over this
process) in such a way that Word can handle a string of data with a " in
it.
I do not care how much I have to "fiddle" the datasource as that part is
very
easy for me. But I do NOT want to have to run Excel to convert the data
into
an Excel spreadsheet and then run Word. Too many steps!

Please Note: If I import into Excel and export as a comma or tab delimited
file I still have the same problem in Word!

What I cannot understand is why Excel imports the data perfectly but Word
cannot. The routine that handles that sort of file should be common to
both
routines but it obviously is totally independant between the two products.

This is a Microsoft problem and I am truly sick of doing work-arounds to
fix
a problem in someone elses software, especially when the problem has been
around for 10 years or more!

Please, please, please can someone either fix the problem in Word or come
up
with a work-around that does not involve a complicated multistep process.

"Cindy M -WordMVP-" wrote:

Hi ?B?Um9zcw==?=,

The process merges data from a database into a Word formatted Invoice
document and I would rather not have to completely rebuild the Invoice
in
Excel.

You misunderstood. Import the data into Excel, then use the Excel file
for
the Word merge instead of the text file.

That, or you have to put 'single quotes' around each field entry that
might
contain a " sign.

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