Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Probleme mit VB6 und MailMerge in Word 97
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! |
#2
|
|||
|
|||
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.QueryS tring (the document object).ActiveDocument.Mailmerge.DataSource.Connec tString 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. "Ralf Dreckmann" Ralf wrote in message ... 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! |
#3
|
|||
|
|||
Hi Peter,
a) It is a *.txt file b) Example for such an txt-file: "Dokumentnummer","User","UKurzzeichen","UTelefon", "UTelefax","UEMail","Unternehmensart","IDBeduerfti ger","IDPfleger","IDBeziehung","IDTatsaechlichePfl ege","OB1","OB2","Rentenversicherungsnummer","IDPf legerExtern","Geschlecht","Zuname","Vorname","Tite l","Vorsatzwort","Strasse","Hausnummer","Land","PL Z","Wohnort","AntragVom","Ablehnungsgrund","Ablehn ungAb","BedGeschlecht","BedVorname","BedZuname","B edTitel","BedVorsatzwort","Amt","Betreuung" 2,"Admin","Adm","+49 700 salutaris","+49 69 ",1,533,620,749,108 4,"583488CK5703","0100/PVN","42041041L503","","2","Pfleger620","Renate"," ","","Pflegerstraße","620","","50000","Köln","9. 5.2004","14","23.3.2004","1","Günter","Bedürftig er533","","","","" 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 "Peter Jamieson" wrote: 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.QueryS tring (the document object).ActiveDocument.Mailmerge.DataSource.Connec tString 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. "Ralf Dreckmann" Ralf wrote in message ... 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! |
#4
|
|||
|
|||
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 "Ralf Dreckmann" wrote in message ... Hi Peter, a) It is a *.txt file b) Example for such an txt-file: "Dokumentnummer","User","UKurzzeichen","UTelefon", "UTelefax","UEMail","Unternehmensart","IDBeduerfti ger","IDPfleger","IDBeziehung","IDTatsaechlichePfl ege","OB1","OB2","Rentenversicherungsnummer","IDPf legerExtern","Geschlecht","Zuname","Vorname","Tite l","Vorsatzwort","Strasse","Hausnummer","Land","PL Z","Wohnort","AntragVom","Ablehnungsgrund","Ablehn ungAb","BedGeschlecht","BedVorname","BedZuname","B edTitel","BedVorsatzwort","Amt","Betreuung" 2,"Admin","Adm","+49 700 salutaris","+49 69 ",1,533,620,749,108 4,"583488CK5703","0100/PVN","42041041L503","","2","Pfleger620","Renate"," ","","Pflegerstraße","620","","50000","Köln","9.5. 2004","14","23.3.2004","1","Günter","Bedürftiger53 3","","","","" 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 "Peter Jamieson" wrote: 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.QueryS tring (the document object).ActiveDocument.Mailmerge.DataSource.Connec tString 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. "Ralf Dreckmann" Ralf wrote in message ... 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! |
#5
|
|||
|
|||
Hi Peter,
thanks for the hints. I will try them and come back later .... Ralf "Peter Jamieson" wrote: 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 "Ralf Dreckmann" wrote in message ... Hi Peter, a) It is a *.txt file b) Example for such an txt-file: "Dokumentnummer","User","UKurzzeichen","UTelefon", "UTelefax","UEMail","Unternehmensart","IDBeduerfti ger","IDPfleger","IDBeziehung","IDTatsaechlichePfl ege","OB1","OB2","Rentenversicherungsnummer","IDPf legerExtern","Geschlecht","Zuname","Vorname","Tite l","Vorsatzwort","Strasse","Hausnummer","Land","PL Z","Wohnort","AntragVom","Ablehnungsgrund","Ablehn ungAb","BedGeschlecht","BedVorname","BedZuname","B edTitel","BedVorsatzwort","Amt","Betreuung" 2,"Admin","Adm","+49 700 salutaris","+49 69 ",1,533,620,749,108 4,"583488CK5703","0100/PVN","42041041L503","","2","Pfleger620","Renate"," ","","Pflegerstraße","620","","50000","Köln","9. 5.2004","14","23.3.2004","1","Günter","Bedürftig er533","","","","" 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 "Peter Jamieson" wrote: 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.QueryS tring (the document object).ActiveDocument.Mailmerge.DataSource.Connec tString 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. "Ralf Dreckmann" Ralf wrote in message ... 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! |
#6
|
|||
|
|||
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 "Peter Jamieson" wrote: 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 "Ralf Dreckmann" wrote in message ... Hi Peter, a) It is a *.txt file b) Example for such an txt-file: "Dokumentnummer","User","UKurzzeichen","UTelefon", "UTelefax","UEMail","Unternehmensart","IDBeduerfti ger","IDPfleger","IDBeziehung","IDTatsaechlichePfl ege","OB1","OB2","Rentenversicherungsnummer","IDPf legerExtern","Geschlecht","Zuname","Vorname","Tite l","Vorsatzwort","Strasse","Hausnummer","Land","PL Z","Wohnort","AntragVom","Ablehnungsgrund","Ablehn ungAb","BedGeschlecht","BedVorname","BedZuname","B edTitel","BedVorsatzwort","Amt","Betreuung" 2,"Admin","Adm","+49 700 salutaris","+49 69 ",1,533,620,749,108 4,"583488CK5703","0100/PVN","42041041L503","","2","Pfleger620","Renate"," ","","Pflegerstraße","620","","50000","Köln","9. 5.2004","14","23.3.2004","1","Günter","Bedürftig er533","","","","" 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 "Peter Jamieson" wrote: 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.QueryS tring (the document object).ActiveDocument.Mailmerge.DataSource.Connec tString 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. "Ralf Dreckmann" Ralf wrote in message ... 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! |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Does Word have Keyboard Merges like Word Perfect does? | Mailmerge | |||
Word2000 letterhead merge | Mailmerge | |||
Underscore (_) will not always display in RTF files (Word 2002). | Microsoft Word Help | |||
How do I keep two words together? | Microsoft Word Help | |||
Macros - Keyboard Commands | Microsoft Word Help |