How to remove automatically some pages?

T

Tico

I read once again your below news and I think that I didn't understand well your advice:
"save each page as a separate document"
when I tried to use it before.
If I have to save each page as a separate document, I'll have to create thousands of files
and for each file to include an information about Excel record (number?) in its name.
I'm afraid this method would be more complicated and take more time than sorting manually. :-(

Regards
Tico
 
G

Graham Mayor

We seem to be talking at cross purposes. From what you have posted earlier,
your merge document has five pages (not thousands), some of which will not
be required according to the dictates of the data. You have said that you
have a field in the data source which indicates which page will not be
required for a given record.

Save each of the five pages as a separate document and note the filename and
path. Then your merge document will contain the conditional fields on the
same line eg

{IF {Mergefield Indicatorfieldname} <> "\" "{Includetext
"c:\\path\\page1.doc" ""}{IF {Mergefield Indicatorfieldname} <> "\"
"{Includetext "c:\\path\\page2.doc" ""}{IF {Mergefield Indicatorfieldname}
<> "\" "{Includetext "c:\\path\\page2.doc" ""}etc

These are fields not simply typed in at the keyboard. Use CTRL+F9 for the
brackets, and note that the paths must use double slashes and of course they
and the fieldnames must match the actual filenames and fieldnames.

Unless the first page of your merge document runs top more than one page,
there will only be one page in the merge document - unless the conditions
require that the includetext fields include them.

When you then merge your database, you will have only the required number of
pages for each record. The merge fields in the inserted documents will work
as if they were typed on the page.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tico

Thanks a lot once more.
We seem to be talking at cross purposes
I am very sorry that my English is so poor. Another problem is that I cannot
use English versions of Windows and MS Office so when I want to describe
anything I have to translate it into English.
From what you have posted earlier, your merge document has five pages (not thousands), some of which will not be required
according to the dictates of the data.
Right.
I'll have thousands of pages as a result of Mailmerge because the Excel file contains
thousends (or at least hundreds) of records.
You have said that you have a field in the data source which indicates which page will not be required for a given record. Right.

Save each of the five pages as a separate document and note the filename and path.
Done.
Each page contains a table. Besides, fieldnames are rather long so each "source" takes
more than 1 page in fact. If it is necessary I could shorten the names of the fields (=names
of Excel columns)
{IF {Mergefield Indicatorfieldname} <> "\" "{Includetext "c:\\path\\page1.doc" ""}{IF {Mergefield Indicatorfieldname} <> "\"
"{Includetext "c:\\path\\page2.doc" ""}{IF {Mergefield Indicatorfieldname} <> "\" "{Includetext "c:\\path\\page2.doc" ""}etc

I opened a new Word97 file and then use:
Tools > MailMerge
1. Create > Form Letters > Active Window
2. Get Data > Open Data Source
I opened my Excel file.
Then I clicked on the Edit Main Document button.

I typed what you wrote using CTRL+F9 (I forgot about it when I tried before).
To get Mergefileld Indicatorfieldname I selected it from the Insert Merge Field (left up corner)

The paths use double slashes and the names of the files are correct.

Afterwards I use:
Tools > MailMerge
3. Merge button
The following options were selected:
Merge to a New Document
Records to be saved All
Without printing empty records
Then I clicked on Merge

I got the following warning:
Microsoft Word
You cannot insert the fields DATA, NEXT, NEXTIF or SKIPIF
inside other fields (this is my translation)

and after clicking on OK I got the following information:
MailMerge
An error was encountered when counting a value of field in record 1
(this is also my tranaslation)

After clicking OK I got just 1 empty page (without inserted values) - the first from 5 pages.
Unless the first page of your merge document runs top more than one page, there will only be one page in the merge document -
unless the conditions require that the includetext fields include them.
I am very sorry but I don't understand it. I suppose it is about what I got but
I have language problems with understanding it. Could you please write it
more simple, without using the word "unless" which is very difficult to me when
I have to understand anything precisely. Sorry.

Best regards
Tico
 
G

Graham Mayor

This is complicated enough to explain in English :)

Given that the language problem might then be reversed, I wonder if it would
help if you sent me the merge documents so that I can see what you are
doing? Zip up the five(?) documents and mail them to the link on my web
site. I *may* be able to spot the problem.

If you are unable to do that - e-mail me a contact address and I'll send you
a sample working document and you can see how it is supposed to work.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tico

Thank you very much for your propositions. That's very kind of you.

I just wanted to send my example to you but I can't find your e-mail
address on your web site www.gmayor.com. :-(

I made some progress. I realised that I made a mistake. I put the names
of the pages which were prepared to sort manually i.e. with conditions
to skip a page when it isn't necessary. That's why I got the warning
about using SKIPIF etc.
After putting correct names I got some results but not quite good yet.

1) I typed the below
{IF {Mergefield Indicatorfieldname} <> "\" "{Includetext
"c:\\path\\page1.doc" ""}{IF {Mergefield Indicatorfieldname} <> "\"
"{Includetext "c:\\path\\page2.doc" ""}{IF {Mergefield Indicatorfieldname}
<> "\" "{Includetext "c:\\path\\page2.doc" ""}etc
but only page1 was processed
I got the same result when I only typed:
{IF {Mergefield Indicatorfieldname} <> "\" "{Includetext "c:\\path\\page1.doc" ""}}

2) all records in Excel file are processed regardless of value in Excel record
(It behaves as if there wasn't the condition <> "\")

Please tell me where is your e-mail address on your web site. I'd like to send
you my example and give you my e-mail address and ask you for sending me
your sample working document

Best regards
Tico
 
G

Graham Mayor

My e-mail link is on the home page of my web site. Messages sent to my MVPS
address are likely to be swallowed by the spam filter, but I rescued this
one :)

I have replied to your e-mail, but for the benefit of others who may be
watching the problem was a minor issue with your syntax in that you put some
of the field content in the rworng place with respect to the fields. When
this is corrected your document works.

You had

{ IF { MERGEFIELD I } <> "\" "{ Includetext "c:\\test\\Sz_I.doc" "" }{ IF
{ MERGEFIELD II_bez } <> "\" "{ Includetext "c:\\test\\Sz_II.doc" "" }{ IF
{ MERGEFIELD II_str } <> "\" "{ Includetext "c:\\test\\Sz_II_s.doc" "" }{ IF
{ MERGEFIELD III_bez } <> "\" "{ Includetext "c:\\test\\Sz_III.doc" "" }{ IF
{ MERGEFIELD III_str } <> "\" "{ Includetext "c:\\test\\Sz_III_s.doc"
""}}}}}}

and it should be

{ IF { MERGEFIELD I } <> "\" "{ Includetext "c:\\test\\Sz_I.doc" } "" \*
MERGEFORMAT }{ IF { MERGEFIELD II_bez } <> "\" "{ Includetext
"c:\\test\\Sz_II.doc" } "" \* MERGEFORMAT }{ IF { MERGEFIELD II_str } <>
"\" "{ Includetext "c:\\test\\Sz_II_s.doc" } "" \* MERGEFORMAT }{ IF {
MERGEFIELD III_bez } <> "\" "{ Includetext "c:\\test\\Sz_III.doc" } "" \*
MERGEFORMAT }{ IF { MERGEFIELD III_str } <> "\" "{ Includetext
"c:\\test\\Sz_III_s.doc" } "" \* MERGEFORMAT }

Some of the field names in your data file had spaces whereas in the fields
they correctly had underscores. You would need to change the data source to
match the fields.

The mergeformat switches may not be necessary but they are probably
desirable.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tico

Thank you very much.
My e-mail link is on the home page of my web site.
I still can't see it there. Sorry.
Messages sent to my MVPS address are likely to be swallowed by the spam filter, but I rescued this one :)
As I don't know if I can write there again, I am answering here.

I used the .doc from you and I replaced the spaces in the field names with
underscores.
At the moment all 5 pages are processed but the condition <> "\" is still
not checked so I get 40 pages as result (8 records in my example by 5 pages).

Besides, there is not correct page break in the output .doc so the text that
should be on the second page begins on the first one and so on.

If you could help me once more, I'd be very grateful.

I didn't know what to do to get correct results so I had to use the method
with manual sorting again. :-( However I have still 3 of 14 "regions" to process.
I regret that I didn't send my question to the group earlier.
As you know I thought about removing unnecessary pages first and then
you gave me the idea of putting only necessary pages.

The task like this is not my usual job but I promised my collagues to do it
and I cannot postpone it.

Best regards
Tico
 
G

Graham Mayor

Tico said:
I still can't see it there. Sorry.
Click the waving note near the bottom of the Home page.
I used the .doc from you and I replaced the spaces in the field names
with underscores.
At the moment all 5 pages are processed but the condition <> "\" is
still not checked so I get 40 pages as result (8 records in my example by
5
pages).

I'm not having the best of days :(

There was an error in my syntax that wouldn't have helped :(. It should have
read:

{ IF { MERGEFIELD I } <> "\" "{ Includetext "c:\\test\\Sz_I.doc" \*
MERGEFORMAT }" ""}{ IF { MERGEFIELD II_bez } <> "\" "{ Includetext
"c:\\test\\Sz_II.doc" \* MERGEFORMAT }" "" }{ IF { MERGEFIELD II_str } <>
"\" "{ Includetext "c:\\test\\Sz_II_s.doc" \* MERGEFORMAT } " "" }{ IF {
MERGEFIELD III_bez } <> "\" "{ Includetext "c:\\test\\Sz_III.doc" \*
MERGEFORMAT }" "" }{ IF { MERGEFIELD III_str } <> "\" "{ Includetext
"c:\\test\\Sz_III_s.doc" \* MERGEFORMAT }" ""}

There appears to be an issue with the slash character '\' that you have used
in the test fields. I would suggest replacing that with '1' or 'A' and
changing the conditional fields accordingly.

The other problems may relate to the fact that you are working in a
different language which I don't understand and which I cannot entirely
reproduce here so I regret I am unable to help you further to get this to
produce exactly what you want.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tico

I still can't see it there. Sorry.
Click the waving note near the bottom of the Home page.
Oh yes. I can see it now.. Sorry, I treated the waving element
as a picture. :)
{ IF { MERGEFIELD I } <> "\" "{ Includetext "c:\\test\\Sz_I.doc" \* MERGEFORMAT }" ""}{ IF { MERGEFIELD II_bez } <> "\" "{
Includetext "c:\\test\\Sz_II.doc" \* MERGEFORMAT }" "" }{ IF { MERGEFIELD II_str } <> "\" "{ Includetext "c:\\test\\Sz_II_s.doc"
\* MERGEFORMAT } " "" }{ IF { MERGEFIELD III_bez } <> "\" "{ Includetext "c:\\test\\Sz_III.doc" \* MERGEFORMAT }" "" }{ IF {
MERGEFIELD III_str } <> "\" "{ Includetext "c:\\test\\Sz_III_s.doc" \* MERGEFORMAT }" ""}
OK. I'll try in a moment.
There appears to be an issue with the slash character '\' that you have used in the test fields. I would suggest replacing that
with '1' or 'A' and changing the conditional fields accordingly.
I thought about it. As you know I wanted to remove pages with any
special character so I chose "\" because it was not used in the data.
Now I can change it.
The other problems may relate to the fact that you are working in a
different language which I don't understand and which I cannot entirely reproduce here so I regret I am unable to help you further
to get this to produce exactly what you want.
I realise that.
I'll try to get correct results on my own.

You mentioned that you could send me your sample working document.
If you did, I'd be happy. :)

Thank you very, very much for all your help. I learnt a lot from you. :)

Best regards
Tico
 
G

Graham Mayor

I have sent you a sample document as requested.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top