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 / May 2007

Tip: Looking for answers? Try searching our database.

Substring used one Mailmerge Fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nikon - 03 May 2007 21:34 GMT
In this office we have documents that take .dat files created from our Oracle
database, and use them for mail merge documents.  Recently the size of the
fields has been increased and the merge documents don't fit some of the
fields anymore.  I am wondering if there is any way, macro or otherwise, that
I can substring (shorten) the merge field so it still fits it's document.  

Essentially what I would like to do is, figure out if a field is over a
certain length and if it is, cut it to a specified length.  Eg. 25
characters.
Peter Jamieson - 04 May 2007 07:24 GMT
The simplest approach is to get your database people to do that in an Oracle
View, or in whatever tool is used to generate the .dat. Every other approach
is much more complicated. There's no simple field that lets you do, e.g. {
=left({ MERGEFIELD x },25) }

If that cannot be done, you can consider...
a. using Word VBA, the OpenDataSource method, and an Oracle SQL query to
get your data directly from Oracle. But you are limited to either 255 or 511
characters in the query (it depends) - that gets used up pretty quickly even
if the underlying query is very simple
b. depending on how Word connects to your .dat file, you /may/ be able to
use the same technique as in (a), but using Jet SQL instead of Oracle SQL.
Similar constraints as in (a) apply.
c. using Word VBA and MailMerge events to truncate each field before each
record is merged
d. preprocessing your .dat in some way to reduce the appropriate field
lengths.

Peter Jamieson

> In this office we have documents that take .dat files created from our
> Oracle
[quoted text clipped - 7 lines]
> certain length and if it is, cut it to a specified length.  Eg. 25
> characters.
 
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.