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 / February 2004

Tip: Looking for answers? Try searching our database.

MailMerge field problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vasile - 13 Feb 2004 17:08 GMT
Hello !

I'm trying to read the mailmerge fields values using the
following VBA code:

If ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters Then
   Dim strtmp As String
   For Each f In
ActiveDocument.MailMerge.DataSource.FieldNames
       strtmp = CStr
(ActiveDocument.MailMerge.DataSource.DataFields
(f.Name).Value)
       
       '...
   Next
End If

The problem is that if the lenght of merge field's value
is greater than 255 chars then
ActiveDocument.MailMerge.DataSource.DataFields
(f.Name).Value returns only the first 255 characters.

Is this a known bug or is there any workaround for this?

Many thanks,
Vasile
Cindy M  -WordMVP- - 13 Feb 2004 20:15 GMT
Hi Vasile,

I wasn't aware of the behavior, but it doesn't surprise me.
Officially, the amount of data that comes across the
mailmerge link is limited to 255 characters. For ever,
there was a "trick" to getting more than this information
for memo fields; the loophole was plugged temporarily in
Word 2000, then opened back up (to a limit of 65,000+, if I
remember correctly) in SP1. And this is the state through
Word 2003, I believe.

So it's not surprising that the VBA functionality works
with this 255 character limit. I'd say, if you really want
this information, set up an ADO or DAO connection to the
data source, using the same SELECT as for the mail merge,
and get the information that way.

> I'm trying to read the mailmerge fields values using the
> following VBA code:
[quoted text clipped - 19 lines]
>  
> Is this a known bug or is there any workaround for this?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
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
:-)
Vasile - 16 Feb 2004 09:37 GMT
Hi Cindy,

Thank you for your reply.

Actually what I was trying to achieve using that macro is
to do a mailmerge within a table (for every record from
the datasource a new row whitin the table is created).

Do you know any better way to achieve this?

Many thanks,
Vasile

>-----Original Message-----
>Hi Vasile,
[quoted text clipped - 49 lines]
>
>.
Cindy M  -WordMVP- - 19 Feb 2004 16:10 GMT
Hi Vasile,

> Actually what I was trying to achieve using that macro is
> to do a mailmerge within a table (for every record from
> the datasource a new row whitin the table is created).
>  
> Do you know any better way to achieve this?

you might try using the DATABASE field; you'll find the
command in the Data toolbar. It may be that this field will
solve your problem and you won't need mail merge. Or, if
your goal is a one-to-many type of list (multiple
items/merge record) you'll find a sample here:

http://www.knowhow.com/Guides/DatabaseInfo/DatabaseInfo.htm

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
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
:-)
 
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.