Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / September 2004

Tip: Looking for answers? Try searching our database.

Merging with non default record separator

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ClaudeV - 18 Sep 2004 20:42 GMT
I use Word mailmerge out of VB 6.0.
With an SQL procedure I create a *.txt file using an SQL
database and merge it to Word, using Word templates. What
is special about my Word templates is that I use "#" as
record separator instead of the default CRLF, which allows
me to use CRLF in bigger database fields.
With Word97 and Word 2000, this worked pretty well. Just
had to save the template once with my desired parameters.
With Word2002, it isn't true any more. First I had to
implement the OpenDatSource command in VB to avoid a
runtime error with Word opening the "Select * from ..."
box. The second problem is, that Word doesn't remember to
use "#" as the record separator and opens the Separator
Box everytime a template is opened out of VB. This would
not be a greater problem as it permits me to indicate the
correct seperator and than continues normally.
Unfortunately, this is is not the entire thing, because
when there are in fact any mergefields with CRLF's
Word2000 returns an error, finding the correct fields
number anymore.
It surely has to do with the OLEDB thing, but I just can't
manage to find out. It would be great if someone could
help me out of this.
Peter Jamieson - 19 Sep 2004 22:50 GMT
Generally speaking, if something worked with VB/VBA in Word 2000 and does
not in Word 2002/3, try adding the parameter

Subtype:=wdMergeSubtypeWord2000

to the OpenDataSource call when opening a data source in Word 2002/3.

(This may not be straightforward if you are trying to automate both Word
2000/97 and Word 202/2003 in the same code.)

Signature

Peter Jamieson

> I use Word mailmerge out of VB 6.0.
> With an SQL procedure I create a *.txt file using an SQL
[quoted text clipped - 19 lines]
> manage to find out. It would be great if someone could
> help me out of this.
ClaudeV - 20 Sep 2004 08:37 GMT
Thank you for your suggestion but I've already tried it
out without any result.
But let me recall the differences I met with Word 2002
when merging:
1. First there is that SQL check window "Select * from .."
that can be removed with the "SQLSecurtiyCheck = 0" Option
in the registry or with the OpenDataSource command under
VB.
2. Then there is the "Set the delimiters" window which
opens everytime I call for a template from VB (not when
opened directly form the Explorer).
3. Even after telling Word to use "#" as record delimiter,
it refuses nevertheless to merge correctly if there is any
CRLF in one of the merged fields, acting as if CRLF still
was the delimiter.
Now, maybe I have to introduce some further command under
VB to tell Word to use "#" as the record delimiter when
merging. But, does anyone know that command? As I said, it
isn't enough adding Subtype:=wdMergeSubtypeWord2000 to the
Opendatsource call.

Best regards,
Claude

>-----Original Message-----
>Generally speaking, if something worked with VB/VBA in Word 2000 and does
[quoted text clipped - 32 lines]
>
>.
Peter Jamieson - 20 Sep 2004 11:48 GMT
> Thank you for your suggestion but I've already tried it
> out without any result.

OK.

> Now, maybe I have to introduce some further command under
> VB to tell Word to use "#" as the record delimiter when
> merging. But, does anyone know that command?

As far as I know,
a. if Word is connecting using ODBC, it always requires the record
delimiter to be CRLF. You can set the /field/ delimiter using a SCHEMA.INI
file.
b. if Word is connecting using its internal text converter, there is no way
to specify the delimiter in code, except perhaps to use Sendkey

I'm less sure about the options if Word is connecting using OLEDB

Can you post your OpenDataSource statement here, please?

Signature

Peter Jamieson

> Thank you for your suggestion but I've already tried it
> out without any result.
[quoted text clipped - 67 lines]
> >
> >.
ClaudeV - 20 Sep 2004 12:32 GMT
Here's the kind of statement I use in VB:
wd.ActiveDocument.MailMerge.OpenDataSource
Name:="C:\Path\database.txt",
SubType:=wdMergeSubTypeWord2000

Claude

>-----Original Message-----
>> Thank you for your suggestion but I've already tried it
[quoted text clipped - 90 lines]
>
>.
ClaudeV - 20 Sep 2004 21:36 GMT
Hi Peter,
Just found out a solution. As I told before I had tried
two things: First the OpenDataSource statement in VB,
second the SQLSecurityCheck=0 Option in the Registry.
I just found out that it's enough to enter the last one
but withdraw the OpenDataSource statement under VB. Both
together don't work. The first doesn't go with the
delimiter change, the second does. Of course, I'm not
happy to withdraw the SQLSecurity check, but as long as I
have no other solution, I'm happy with it.
So, thanks for now. Maybe someone will get a better idea
later.
Yours sincerely,
Claude

>-----Original Message-----
>Here's the kind of statement I use in VB:
[quoted text clipped - 127 lines]
>>
>.
Peter Jamieson - 21 Sep 2004 06:25 GMT
Thanks for the feedback - I do not have a better answer.

Signature

Peter Jamieson

> Hi Peter,
> Just found out a solution. As I told before I had tried
[quoted text clipped - 149 lines]
> >>
> >.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.