Reply
 
Thread Tools Display Modes
  #1   Report Post  
haliburton girl
 
Posts: n/a
Default how do I delete commas in a field when blank

I am trying to make a directory. I have the fields listed but when the data
is put in, the commas remain for blank fields. It looks like this
teaching,,,,,writing,speech,
  #2   Report Post  
Graham Mayor
 
Posts: n/a
Default

If this is a data file, you would expect the commas to be present. They mark
the fields. If they are in the merged document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but when
the data is put in, the commas remain for blank fields. It looks
like this teaching,,,,,writing,speech,



  #3   Report Post  
haliburton girl
 
Posts: n/a
Default

I am making a directory. Some of the fields in my database are blank. When
merging them the comma stays between each entry so the blank ones show as a
comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be present. They mark
the fields. If they are in the merged document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but when
the data is put in, the commas remain for blank fields. It looks
like this teaching,,,,,writing,speech,




  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

Yes, but is the comma in the data or have *you* introduced it between
fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF {Mergefield Field2}
"" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is not
empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field produces in a
similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so the
blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be present.
They mark the fields. If they are in the merged document, where are
they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but when
the data is put in, the commas remain for blank fields. It looks
like this teaching,,,,,writing,speech,



  #5   Report Post  
haliburton girl
 
Posts: n/a
Default

*I* have introduced it between fields as I want it to look like a list.

I will try to make an "if" statement, but what is the condition. Do I
just put an "if" merge field 1 then merge field 1, I am sorry but WORD
confuses me in its insert word field. Is that where I find the "if"
statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it between
fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF {Mergefield Field2}
"" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is not
empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field produces in a
similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so the
blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be present.
They mark the fields. If they are in the merged document, where are
they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but when
the data is put in, the commas remain for blank fields. It looks
like this teaching,,,,,writing,speech,






  #6   Report Post  
Graham Mayor
 
Posts: n/a
Default

To create a conditional (IF) statement in mail merge, the simplest method is
to insert it from the keyboard directly. For this you need to know the names
of the fields and that CTRL+F9 inserts field boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then insert the
bits between the speech marks ie the contents of the field and the comma
following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter this"}

Having entered the fields select them and press F9 to update them, then if
necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition. Do
I just put an "if" merge field 1 then merge field 1, I am sorry but
WORD confuses me in its insert word field. Is that where I find the
"if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it between
fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF {Mergefield
Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is
not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so the
blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be present.
They mark the fields. If they are in the merged document, where are
they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields. It
looks like this teaching,,,,,writing,speech,



  #7   Report Post  
haliburton girl
 
Posts: n/a
Default

Yes, now I have commas only where I want them. However, when there is
nothing in the database it puts a space. I guess I need another condition
but unsure how to write it.
Thanks.
Haliburton

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest method is
to insert it from the keyboard directly. For this you need to know the names
of the fields and that CTRL+F9 inserts field boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then insert the
bits between the speech marks ie the contents of the field and the comma
following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter this"}

Having entered the fields select them and press F9 to update them, then if
necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition. Do
I just put an "if" merge field 1 then merge field 1, I am sorry but
WORD confuses me in its insert word field. Is that where I find the
"if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it between
fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF {Mergefield
Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is
not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so the
blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be present.
They mark the fields. If they are in the merged document, where are
they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields. It
looks like this teaching,,,,,writing,speech,




  #8   Report Post  
haliburton girl
 
Posts: n/a
Default

Another frustrating thing. I try and try to format the main document to
Times New Roman 10 and it seems to do it, but when I merge those fields are
some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest method is
to insert it from the keyboard directly. For this you need to know the names
of the fields and that CTRL+F9 inserts field boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then insert the
bits between the speech marks ie the contents of the field and the comma
following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter this"}

Having entered the fields select them and press F9 to update them, then if
necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition. Do
I just put an "if" merge field 1 then merge field 1, I am sorry but
WORD confuses me in its insert word field. Is that where I find the
"if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it between
fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF {Mergefield
Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is
not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so the
blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be present.
They mark the fields. If they are in the merged document, where are
they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields. It
looks like this teaching,,,,,writing,speech,




  #9   Report Post  
Graham Mayor
 
Posts: n/a
Default

You don't need another condition, put the space, currently outside the
fields, inside the result along with the comma, so that you only get a space
if there's a record entry.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Yes, now I have commas only where I want them. However, when there is
nothing in the database it puts a space. I guess I need another
condition but unsure how to write it.
Thanks.
Haliburton

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest
method is to insert it from the keyboard directly. For this you need
to know the names of the fields and that CTRL+F9 inserts field
boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then insert
the bits between the speech marks ie the contents of the field and
the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter this"}

Having entered the fields select them and press F9 to update them,
then if necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition.
Do I just put an "if" merge field 1 then merge field 1, I am sorry
but WORD confuses me in its insert word field. Is that where I
find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is
not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so
the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields. It
looks like this teaching,,,,,writing,speech,



  #10   Report Post  
Graham Mayor
 
Posts: n/a
Default

Add a \*charformat switch (or change the \*mergeformat switch if present)
to the offending fields. eg

{Mergefield fieldname \*charformat} this will cause the merge to adopt the
formatting of the inserted field.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Another frustrating thing. I try and try to format the main document
to Times New Roman 10 and it seems to do it, but when I merge those
fields are some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest
method is to insert it from the keyboard directly. For this you need
to know the names of the fields and that CTRL+F9 inserts field
boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then insert
the bits between the speech marks ie the contents of the field and
the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter this"}

Having entered the fields select them and press F9 to update them,
then if necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition.
Do I just put an "if" merge field 1 then merge field 1, I am sorry
but WORD confuses me in its insert word field. Is that where I
find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is
not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so
the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields. It
looks like this teaching,,,,,writing,speech,





  #11   Report Post  
haliburton girl
 
Posts: n/a
Default

Graham,
It is almost perfect but at the end of each of my directory lists there is a
comma. Is there any script that will tell it that it is the end and no
comma? Or should I take them out manually?
thanks,
J

"Graham Mayor" wrote:

Add a \*charformat switch (or change the \*mergeformat switch if present)
to the offending fields. eg

{Mergefield fieldname \*charformat} this will cause the merge to adopt the
formatting of the inserted field.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Another frustrating thing. I try and try to format the main document
to Times New Roman 10 and it seems to do it, but when I merge those
fields are some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest
method is to insert it from the keyboard directly. For this you need
to know the names of the fields and that CTRL+F9 inserts field
boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then insert
the bits between the speech marks ie the contents of the field and
the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter this"}

Having entered the fields select them and press F9 to update them,
then if necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition.
Do I just put an "if" merge field 1 then merge field 1, I am sorry
but WORD confuses me in its insert word field. Is that where I
find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field is
not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so
the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields. It
looks like this teaching,,,,,writing,speech,




  #12   Report Post  
Graham Mayor
 
Posts: n/a
Default

Assuming that you always have a first field then put the comma at the
beginning eg

{Mergefield field1}{IF {Mergefield field2} "" ", {Mergefield field2}"}
etc.

If you don't always have a field1 then it will prove a little more fiddly. I
would need to know what fields you have.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Graham,
It is almost perfect but at the end of each of my directory lists
there is a comma. Is there any script that will tell it that it is
the end and no comma? Or should I take them out manually?
thanks,
J

"Graham Mayor" wrote:

Add a \*charformat switch (or change the \*mergeformat switch if
present) to the offending fields. eg

{Mergefield fieldname \*charformat} this will cause the merge to
adopt the formatting of the inserted field.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Another frustrating thing. I try and try to format the main
document to Times New Roman 10 and it seems to do it, but when I
merge those fields are some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest
method is to insert it from the keyboard directly. For this you
need to know the names of the fields and that CTRL+F9 inserts field
boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then
insert the bits between the speech marks ie the contents of the
field and the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter
this"}

Having entered the fields select them and press F9 to update them,
then if necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition.
Do I just put an "if" merge field 1 then merge field 1, I am sorry
but WORD confuses me in its insert word field. Is that where I
find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field
is not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so
the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields.
It looks like this teaching,,,,,writing,speech,



  #13   Report Post  
haliburton girl
 
Posts: n/a
Default

HI Graham,
I am afraid that everyone isn't listing in the first field. The fields are
lists of what type of writing we do and so everyone is different. So the
list is sometimes short, even non-existent, and sometimes long. I have a
subheading "Interests", then the list proceeds. I can manually delete all
the commas at the end of each person but I have 260 entries.

"Graham Mayor" wrote:

Assuming that you always have a first field then put the comma at the
beginning eg

{Mergefield field1}{IF {Mergefield field2} "" ", {Mergefield field2}"}
etc.

If you don't always have a field1 then it will prove a little more fiddly. I
would need to know what fields you have.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Graham,
It is almost perfect but at the end of each of my directory lists
there is a comma. Is there any script that will tell it that it is
the end and no comma? Or should I take them out manually?
thanks,
J

"Graham Mayor" wrote:

Add a \*charformat switch (or change the \*mergeformat switch if
present) to the offending fields. eg

{Mergefield fieldname \*charformat} this will cause the merge to
adopt the formatting of the inserted field.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Another frustrating thing. I try and try to format the main
document to Times New Roman 10 and it seems to do it, but when I
merge those fields are some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the simplest
method is to insert it from the keyboard directly. For this you
need to know the names of the fields and that CTRL+F9 inserts field
boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then
insert the bits between the speech marks ie the contents of the
field and the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter
this"}

Having entered the fields select them and press F9 to update them,
then if necessary ALT+F9 to tooggle the display to show the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like a
list.

I will try to make an "if" statement, but what is the condition.
Do I just put an "if" merge field 1 then merge field 1, I am sorry
but WORD confuses me in its insert word field. Is that where I
find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field
is not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database are
blank. When merging them the comma stays between each entry so
the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed but
when the data is put in, the commas remain for blank fields.
It looks like this teaching,,,,,writing,speech,




  #14   Report Post  
Graham Mayor
 
Posts: n/a
Default

I suspect that it will be more complicated to not place the commas than to
remove them later. Merge to a new document. If the list for each record ends
with a paragraph mark then use replace to replace ,^p with ^p (or use the
macro)

Sub LoseTheCommas()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ",^13"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
HI Graham,
I am afraid that everyone isn't listing in the first field. The
fields are lists of what type of writing we do and so everyone is
different. So the list is sometimes short, even non-existent, and
sometimes long. I have a subheading "Interests", then the list
proceeds. I can manually delete all the commas at the end of each
person but I have 260 entries.

"Graham Mayor" wrote:

Assuming that you always have a first field then put the comma at the
beginning eg

{Mergefield field1}{IF {Mergefield field2} "" ", {Mergefield
field2}"} etc.

If you don't always have a field1 then it will prove a little more
fiddly. I would need to know what fields you have.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Graham,
It is almost perfect but at the end of each of my directory lists
there is a comma. Is there any script that will tell it that it is
the end and no comma? Or should I take them out manually?
thanks,
J

"Graham Mayor" wrote:

Add a \*charformat switch (or change the \*mergeformat switch if
present) to the offending fields. eg

{Mergefield fieldname \*charformat} this will cause the merge to
adopt the formatting of the inserted field.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Another frustrating thing. I try and try to format the main
document to Times New Roman 10 and it seems to do it, but when I
merge those fields are some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the
simplest method is to insert it from the keyboard directly. For
this you need to know the names of the fields and that CTRL+F9
inserts field boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then
insert the bits between the speech marks ie the contents of the
field and the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter
this"}

Having entered the fields select them and press F9 to update
them, then if necessary ALT+F9 to tooggle the display to show
the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like
a list.

I will try to make an "if" statement, but what is the
condition. Do I just put an "if" merge field 1 then merge field
1, I am sorry but WORD confuses me in its insert word field.
Is that where I find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field
is not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database
are blank. When merging them the comma stays between each
entry so the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed
but when the data is put in, the commas remain for blank
fields. It looks like this teaching,,,,,writing,speech,



  #15   Report Post  
haliburton girl
 
Posts: n/a
Default

I am sorry but this message made no sense to me at all. What is a paragraph
mark? And when do I use the macro (I assume that is that big long
complicated script below in your message)? And I actually do all this once
it has merged all the files into a new document? Or do I do it in the setup?
J

"Graham Mayor" wrote:

I suspect that it will be more complicated to not place the commas than to
remove them later. Merge to a new document. If the list for each record ends
with a paragraph mark then use replace to replace ,^p with ^p (or use the
macro)

Sub LoseTheCommas()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ",^13"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
HI Graham,
I am afraid that everyone isn't listing in the first field. The
fields are lists of what type of writing we do and so everyone is
different. So the list is sometimes short, even non-existent, and
sometimes long. I have a subheading "Interests", then the list
proceeds. I can manually delete all the commas at the end of each
person but I have 260 entries.

"Graham Mayor" wrote:

Assuming that you always have a first field then put the comma at the
beginning eg

{Mergefield field1}{IF {Mergefield field2} "" ", {Mergefield
field2}"} etc.

If you don't always have a field1 then it will prove a little more
fiddly. I would need to know what fields you have.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Graham,
It is almost perfect but at the end of each of my directory lists
there is a comma. Is there any script that will tell it that it is
the end and no comma? Or should I take them out manually?
thanks,
J

"Graham Mayor" wrote:

Add a \*charformat switch (or change the \*mergeformat switch if
present) to the offending fields. eg

{Mergefield fieldname \*charformat} this will cause the merge to
adopt the formatting of the inserted field.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
Another frustrating thing. I try and try to format the main
document to Times New Roman 10 and it seems to do it, but when I
merge those fields are some other font.
thanks,
Jan

"Graham Mayor" wrote:

To create a conditional (IF) statement in mail merge, the
simplest method is to insert it from the keyboard directly. For
this you need to know the names of the fields and that CTRL+F9
inserts field boundaries {}.

The construction is then similar to

{IF {Mergefield Field1} "" "{Mergefield Field1},"}

What this means is that if the content of the field called field1
(substitute your own field name) is not equal to nothing then
insert the bits between the speech marks ie the contents of the
field and the comma following it.

ie
{IF {Mergefield Fieldname} "" "enter this" "otherwise enter
this"}

Having entered the fields select them and press F9 to update
them, then if necessary ALT+F9 to tooggle the display to show
the result.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
*I* have introduced it between fields as I want it to look like
a list.

I will try to make an "if" statement, but what is the
condition. Do I just put an "if" merge field 1 then merge field
1, I am sorry but WORD confuses me in its insert word field.
Is that where I find the "if" statement. If so, which one?
thanks,

"Graham Mayor" wrote:

Yes, but is the comma in the data or have *you* introduced it
between fields?
eg
{Mergefield field1},{Mergefield Field2}, etc

If the latter, then you need a set of conditional fields eg

{IF {Mergefield Field1} "" "{Mergefield Field1},"}{IF
{Mergefield Field2} "" "{Mergefield Field2},"} etc

ie you conditionally place the field and the comma if the field
is not empty. If it is empty nothing is inserted.

If the former then you need to trap whatever an 'empty' field
produces in a similar manner.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am making a directory. Some of the fields in my database
are blank. When merging them the comma stays between each
entry so the blank ones show as a comma each time.
Jan

"Graham Mayor" wrote:

If this is a data file, you would expect the commas to be
present. They mark the fields. If they are in the merged
document, where are they coming from?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


haliburton girl wrote:
I am trying to make a directory. I have the fields listed
but when the data is put in, the commas remain for blank
fields. It looks like this teaching,,,,,writing,speech,






  #16   Report Post  
Graham Mayor
 
Posts: n/a
Default

haliburton girl wrote:
I am sorry but this message made no sense to me at all. What is a
paragraph mark? And when do I use the macro (I assume that is that
big long complicated script below in your message)? And I actually
do all this once it has merged all the files into a new document? Or
do I do it in the setup? J

"Graham Mayor" wrote:


A paragraph mark is what ends a paragraph - ie if you click ¶ on the toolbar
(or CTRL+*) you can display the formatting (repeat the commnad to change it
back again)

If your list looks like
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶

Then the replace function will work (the macro simply runs the same replace
function) http://www.gmayor.com/installing_macro.htm
Merge to a new document and run the replace on that document.
ie
replace
,^p
with
^p
If there is a space between , and ¶ then replace
, ^p
with
^p

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



  #17   Report Post  
haliburton girl
 
Posts: n/a
Default

I think I will just do as you said and take the commas out by hand.
thanks for all your help
J

"Graham Mayor" wrote:

haliburton girl wrote:
I am sorry but this message made no sense to me at all. What is a
paragraph mark? And when do I use the macro (I assume that is that
big long complicated script below in your message)? And I actually
do all this once it has merged all the files into a new document? Or
do I do it in the setup? J

"Graham Mayor" wrote:


A paragraph mark is what ends a paragraph - ie if you click ¶ on the toolbar
(or CTRL+*) you can display the formatting (repeat the commnad to change it
back again)

If your list looks like
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶
mmmmm, nnnnnnnnn,¶
mmmmm, nnnnnnnnn, nnnnnnnn, nnnnnnnn,¶

Then the replace function will work (the macro simply runs the same replace
function) http://www.gmayor.com/installing_macro.htm
Merge to a new document and run the replace on that document.
ie
replace
,^p
with
^p
If there is a space between , and ¶ then replace
, ^p
with
^p

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




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
How do I delete blank spaces in word? DanielVillatoro Microsoft Word Help 7 September 13th 05 01:06 AM
cant delete blank page dlb1228 Microsoft Word Help 1 August 24th 05 05:53 PM
can't delete one half of a word field bracket LizW Microsoft Word Help 1 June 15th 05 11:31 PM
How do I delete a section title field in Word lifire103 Microsoft Word Help 1 May 2nd 05 09:38 PM
How to I delete blank lines/labels in the mail merge function? Suzieq Mailmerge 2 December 17th 04 03:21 AM


All times are GMT +1. The time now is 11:12 AM.

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"