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 / November 2006

Tip: Looking for answers? Try searching our database.

MAILMERGE IF condition - long text strings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PromisedOyster - 10 Nov 2006 05:37 GMT
I get the error message: String is longer than 255 characters if I
execute the following code AND the length of oTrueText is greater than
255 characters.

Word.MailMergeField condition =
_wordDoc.MailMerge.Fields.AddIf(_wordApp.Selection.Range
        ,fieldName
        ,wdComparison
        ,ref oCompareTo
        ,ref oMissing
        ,ref oTrueText
        ,ref oMissing
        ,ref oFalseText
        );

Is there any way around this?

I want to create an IF condition with quite long text strings
Doug Robbins - Word MVP - 10 Nov 2006 06:00 GMT
Use an IncludeText field in place of the oTrueText and have the string in
the file that is referred to in the IncludeText Field.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I get the error message: String is longer than 255 characters if I
> execute the following code AND the length of oTrueText is greater than
[quoted text clipped - 14 lines]
>
> I want to create an IF condition with quite long text strings
macropod - 10 Nov 2006 10:48 GMT
Hi Doug (and PromisedOyster),

Inserting an INCLUDETEXT field via the Addif method doesn't work. Mainly
because inserting the INCLUDETEXT field in code requires the insertion range
to be available and, until the Addif process is complete, the target range
doesn't exist. The workaround is to insert a 'token' of some sort (eg the
string 'oTrueText') where the TRUE condition goes, then replace that 'token'
after the Addif process has completed. Whilst you could then put the
INCLUDETEXT field in that spot, you might find it's equally possible to
replace it with the contents of oTrueText explicitly.

Cheers

Signature

macropod
[MVP - Microsoft Word]

> Use an IncludeText field in place of the oTrueText and have the string in
> the file that is referred to in the IncludeText Field.
[quoted text clipped - 17 lines]
> >
> > I want to create an IF condition with quite long text strings
Doug Robbins - Word MVP - 10 Nov 2006 12:18 GMT
I would never use code to create a mailmerge main document.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi Doug (and PromisedOyster),
>
[quoted text clipped - 32 lines]
>> >
>> > I want to create an IF condition with quite long text strings
 
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.