Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
ThomasAJ ThomasAJ is offline
external usenet poster
 
Posts: 21
Default How to embed Control Characters into data feeding a merge field.

I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by making
it bold (note - NOT the whole field). What control characters do I embed?. Is
there a list of other control chars. say italic etc.

--
Regards
Tom
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How to embed Control Characters into data feeding a merge field.

That is not something that can be done with mail merge out of the box. You
could achieve it by inserting some control characters in the data and then
execute the merge to a new document and then use a wildcard search and
replace in some VBA code to locate the strings between the control
characters and apply the desired formatting.

--
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

"ThomasAJ" wrote in message
...
I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by
making
it bold (note - NOT the whole field). What control characters do I embed?.
Is
there a list of other control chars. say italic etc.

--
Regards
Tom



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
ThomasAJ ThomasAJ is offline
external usenet poster
 
Posts: 21
Default How to embed Control Characters into data feeding a merge fiel

So I cannot insert some special ASCII/ANSI type chars in the actual data that
Word will interpret as say bold? The control chars you are talking about are
ones that I invent for my VBA code to locate and turn the 'target text' into
bold.

Am I understanding you correctly?

--
Regards
Tom


"Doug Robbins - Word MVP" wrote:

That is not something that can be done with mail merge out of the box. You
could achieve it by inserting some control characters in the data and then
execute the merge to a new document and then use a wildcard search and
replace in some VBA code to locate the strings between the control
characters and apply the desired formatting.

--
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

"ThomasAJ" wrote in message
...
I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by
making
it bold (note - NOT the whole field). What control characters do I embed?.
Is
there a list of other control chars. say italic etc.

--
Regards
Tom




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How to embed Control Characters into data feeding a merge fiel

Yes, Tom. That is what I had meant.

--
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

"ThomasAJ" wrote in message
...
So I cannot insert some special ASCII/ANSI type chars in the actual data
that
Word will interpret as say bold? The control chars you are talking about
are
ones that I invent for my VBA code to locate and turn the 'target text'
into
bold.

Am I understanding you correctly?

--
Regards
Tom


"Doug Robbins - Word MVP" wrote:

That is not something that can be done with mail merge out of the box.
You
could achieve it by inserting some control characters in the data and
then
execute the merge to a new document and then use a wildcard search and
replace in some VBA code to locate the strings between the control
characters and apply the desired formatting.

--
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

"ThomasAJ" wrote in message
...
I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by
making
it bold (note - NOT the whole field). What control characters do I
embed?.
Is
there a list of other control chars. say italic etc.

--
Regards
Tom






  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default How to embed Control Characters into data feeding a merge field.

You can try the following trick if you like but be aware that it has
significant limitations (e.g. you probably can't have more than the maximum
Word column count) so test thoroughly before committing:

Instead of writing a plain text file, write an HTML format file, using
standard HTML formatting tags. As faras I know you can reduce the amount of
HTML you need by leaving out HTML, BODY. But keep the table tags.

e.g.

table
trtdkey/tdtdtext/td/tr
trtd1/tdtdplain1 bbold and iitalic/i/b/td/tr
trtd2/tdtdplain2 uunderscore/u/td/tr
/table

You can use th instead of td in the header line (I doubt if it makes any
difference to Word, but it might). Make sure every row has the same number
of cells. Give the file a .htm extension.

Use that as the data source, but instead of inserting MERGEFIELD fields,
insert REF fields, e.g. { REF k } and { REF text }. You will probably also
need to insert one "real" merge field that evaluates to an empty text string
before Word will let you perform the merge. e.g. { { MERGEFIELD k } } may do
the trick.

When you evaluate these fields, you will probably see "Error! Reference
source not found", but if you preview the data, you should see the data +
formatting that you included.

This relies on the fact that the earliest versions of Windows Word could
only use Word documents as a data source, did not have { MERGEFIELD }
fields, and just used { fieldname } instead of { MERGEFIELD fieldname }. The
behaviour seems to have been carried through until at least Word 2003, but
is probably not supported. Using REF is a way to avoid problems where the
fieldname is the same as a Word field type such as AUTHOR etc.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"ThomasAJ" wrote in message
...
I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by
making
it bold (note - NOT the whole field). What control characters do I embed?.
Is
there a list of other control chars. say italic etc.

--
Regards
Tom




  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
ThomasAJ ThomasAJ is offline
external usenet poster
 
Posts: 21
Default How to embed Control Characters into data feeding a merge fiel

Thanks Peter. Interesting but too complicated for my task.

Also it's interesting that embeded CRLFs in text data feeding a merge field
causes Word to start a new line within that merge field.

Are you all 100% sure that special ASCII/ANSI chars (eg the one for bold)
will NOT display a word in bold? Just pushing this a little further

--
Regards
Tom


"Peter Jamieson" wrote:

You can try the following trick if you like but be aware that it has
significant limitations (e.g. you probably can't have more than the maximum
Word column count) so test thoroughly before committing:

Instead of writing a plain text file, write an HTML format file, using
standard HTML formatting tags. As faras I know you can reduce the amount of
HTML you need by leaving out HTML, BODY. But keep the table tags.

e.g.

table
trtdkey/tdtdtext/td/tr
trtd1/tdtdplain1 bbold and iitalic/i/b/td/tr
trtd2/tdtdplain2 uunderscore/u/td/tr
/table

You can use th instead of td in the header line (I doubt if it makes any
difference to Word, but it might). Make sure every row has the same number
of cells. Give the file a .htm extension.

Use that as the data source, but instead of inserting MERGEFIELD fields,
insert REF fields, e.g. { REF k } and { REF text }. You will probably also
need to insert one "real" merge field that evaluates to an empty text string
before Word will let you perform the merge. e.g. { { MERGEFIELD k } } may do
the trick.

When you evaluate these fields, you will probably see "Error! Reference
source not found", but if you preview the data, you should see the data +
formatting that you included.

This relies on the fact that the earliest versions of Windows Word could
only use Word documents as a data source, did not have { MERGEFIELD }
fields, and just used { fieldname } instead of { MERGEFIELD fieldname }. The
behaviour seems to have been carried through until at least Word 2003, but
is probably not supported. Using REF is a way to avoid problems where the
fieldname is the same as a Word field type such as AUTHOR etc.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"ThomasAJ" wrote in message
...
I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by
making
it bold (note - NOT the whole field). What control characters do I embed?.
Is
there a list of other control chars. say italic etc.

--
Regards
Tom



  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default How to embed Control Characters into data feeding a merge fiel

Let me put it this way - if you use the ones that Word specifically mentions
in its Autocorrect options dialog (** to surround bold and _ _ to surround
italic) in a .txt data source, the field results are /not/ formatted as you
might hope.

Also it's interesting that embeded CRLFs in text data feeding a merge
field
causes Word to start a new line within that merge field.


Are you all 100% sure that special ASCII/ANSI chars (eg the one for bold)


When it comes to the software world, I generally feel I wouldn't be doing my
job if I were 100% sure about anything :-)

I'm not personally aware of any ANSI/ASCII standard for control characters
for bold etc., only the conventions that grew up for marking up e-mails with
simple formatting (actually I thought _ _ was supposed to be underscore and
/ / was supposed to be italic in that scheme, but there you go.) But if you
have something else in mind, it should be pretty easy to test...

--
Peter Jamieson
http://tips.pjmsn.me.uk

"ThomasAJ" wrote in message
news
Thanks Peter. Interesting but too complicated for my task.

Also it's interesting that embeded CRLFs in text data feeding a merge
field
causes Word to start a new line within that merge field.

Are you all 100% sure that special ASCII/ANSI chars (eg the one for bold)
will NOT display a word in bold? Just pushing this a little further

--
Regards
Tom


"Peter Jamieson" wrote:

You can try the following trick if you like but be aware that it has
significant limitations (e.g. you probably can't have more than the
maximum
Word column count) so test thoroughly before committing:

Instead of writing a plain text file, write an HTML format file, using
standard HTML formatting tags. As faras I know you can reduce the amount
of
HTML you need by leaving out HTML, BODY. But keep the table tags.

e.g.

table
trtdkey/tdtdtext/td/tr
trtd1/tdtdplain1 bbold and iitalic/i/b/td/tr
trtd2/tdtdplain2 uunderscore/u/td/tr
/table

You can use th instead of td in the header line (I doubt if it makes any
difference to Word, but it might). Make sure every row has the same
number
of cells. Give the file a .htm extension.

Use that as the data source, but instead of inserting MERGEFIELD fields,
insert REF fields, e.g. { REF k } and { REF text }. You will probably
also
need to insert one "real" merge field that evaluates to an empty text
string
before Word will let you perform the merge. e.g. { { MERGEFIELD k } } may
do
the trick.

When you evaluate these fields, you will probably see "Error! Reference
source not found", but if you preview the data, you should see the data +
formatting that you included.

This relies on the fact that the earliest versions of Windows Word could
only use Word documents as a data source, did not have { MERGEFIELD }
fields, and just used { fieldname } instead of { MERGEFIELD fieldname }.
The
behaviour seems to have been carried through until at least Word 2003,
but
is probably not supported. Using REF is a way to avoid problems where the
fieldname is the same as a Word field type such as AUTHOR etc.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"ThomasAJ" wrote in message
...
I have a merge field that gets fed text type data from a database.

Somewhere within the text source I want to say highlight a PORTION by
making
it bold (note - NOT the whole field). What control characters do I
embed?.
Is
there a list of other control chars. say italic etc.

--
Regards
Tom




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Embed word control as rich text control in asp.net? Daniel Microsoft Word Help 1 May 7th 07 08:56 PM
Mail merge data that is used to control the document contents Simon J Mailmerge 1 December 14th 06 01:05 PM
Merge field control in Documents PhilD Mailmerge 1 May 17th 06 03:15 PM
Help using Access check box control in IF...THEN...merge field geisi Mailmerge 8 September 15th 05 02:03 PM
Merge data does not all appear. Is there a limit on characters? Gracey Mailmerge 0 August 29th 05 03:42 PM


All times are GMT +1. The time now is 04:13 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"