Probleme mit VB6 und MailMerge in Word 97

R

Ralf Dreckmann

Folgender Sachverhalt:
Eine VB6 Anwendung erstellt eine Datendatei und baut dann via Word ein
Dokument zusammen. Abschließend wird das Dokument und die Datendatei zu einem
Serienbrief zusammengefasst. Dies funktioniert einwandfrei bei Word 2000 und
höher - allerdings bei einigen anwendern nicht, wenn Word 97 im Spiel ist. In
diesen Fällen wird bei dem Zusammenmischen des Dokuments und der Daten immer
darauf verwiesen, dass die Daten des Dokuments nicht in der Datendatei
enthalten sind - was natürlich falsch ist, den die Daten sind definitiv
vorhanden.

Hat irgendwer eine Idee, was dies sein könnte - ich verzweifle langsam an
diesem Problem ...

Danke!
 
P

Peter Jamieson

What format is the data file? .txt? .csv? etc. If it is a .txt file, what
field delimiter and record delimiter are you using?

Also, if you do the merge manually in Word 97 using the same data file, does
the merge work, or do you see the same error?

Are you calling an OpenDataSource method? If so, what are the parameters? If
not, can you tell us the values of
(the document object).ActiveDocument.Mailmerge.DataSource.Name
(the document object).ActiveDocument.Mailmerge.DataSource.QueryString
(the document object).ActiveDocument.Mailmerge.DataSource.ConnectString

Peter Jamieson


If it is a delimited format such as .txt, there can be a problem because in
some cases Word uses an internal converter to read the file, and in other
cases it uses ODBC.
 
R

Ralf Dreckmann

Hi Peter,

a) It is a *.txt file

b) Example for such an txt-file:
"Dokumentnummer","User","UKurzzeichen","UTelefon","UTelefax","UEMail","Unternehmensart","IDBeduerftiger","IDPfleger","IDBeziehung","IDTatsaechlichePflege","OB1","OB2","Rentenversicherungsnummer","IDPflegerExtern","Geschlecht","Zuname","Vorname","Titel","Vorsatzwort","Strasse","Hausnummer","Land","PLZ","Wohnort","AntragVom","Ablehnungsgrund","AblehnungAb","BedGeschlecht","BedVorname","BedZuname","BedTitel","BedVorsatzwort","Amt","Betreuung"
2,"Admin","Adm","+49 700 salutaris","+49 69
791237770","(e-mail address removed)",1,533,620,749,1084,"583488CK5703","0100/PVN","42041041L503","","2","Pfleger620","Renate","","","Pflegerstraße","620","","50000","Köln","9.5.2004","14","23.3.2004","1","Günter","Bedürftiger533","","","",""

c) I don't see it - only some users; this problem does not exists at the
development PC's.

d) See this coding:
With mobjWordDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=gsWWUserdatei, Format:=wdOpenFormatText,
ConfirmConversions:=True, ReadOnly:=True
.Destination = wdSendToNewDocument
.Execute (True)
End With

We thought, that "Format:=wdOpenFormatText, ConfirmConversions:=True," could
solve this problem - but it don't.

Some ideas?!?

Ralf
 
P

Peter Jamieson

Hi Ralf

One possible problem is that Word can use two different mechanisms to
connect to .txt data
(1) its internal text converter
(2) ODBC

In some cases Word will try to use ODBC even when you do not specify it in
the OpenDataSource call, and in those cases it can fail.

If you can use one of the machines that fails to test changes, I would
consider the following:
a. Determine whether ODBC is installed on that machine, whether the Text
Driver is installed, and whether there is a Text DSN.
b. try changing the .txt file extension to .dat or
c. use the ODBC administrator to set up a schema.ini file that specifies
that the file is comma-delimited with a header line (if necessary you can
try this on your own system, see the schema.ini that is created, edit it in
notepad and copy it to the test machine)
We thought, that "Format:=wdOpenFormatText, ConfirmConversions:=True,"
could
solve this problem - but it don't.

Many of the parameters to OpenDataSource do not do anything at all in most
cases, even when they sound as if they should. Usually, only Name,
Connection, SQLStatement, SQLStatement1, and in Word 2002/2003, Subtype
actually have any impact.

Peter Jamieson
 
R

Ralf Dreckmann

Hi Peter,

thanks for the hints. I will try them and come back later ....

Ralf
 
R

Ralf Dreckmann

Hi Peter,

this was the right tip. The result is:
a) when the ODBC-Driver for the txt-file (who will use this?) is erased - it
works!
b) when the data-file is not named as a txt-file - it works, also when the
ODBC-Driver is installed.

Thanks a lot
Ralf
 

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