Merge from Microsoft Business Solutions C5, removing of empty fields

M

Mads W.

Im running Microsoft Business Solutions C5 (C5), which is an ERP system from
Denmark.
C5 has a function that can merge to Word. I use Word 2003.

When merging, C5 uses a template, where the merge fields are FORMTEXT fields
with a Bookmark.
I have tried using IF, THEN, ELSE MERGEFIELDS. But it seems that I can't do
that because of the way the merge function is set up in C5.
I can however use the bookmarks without the FORMTEXT field. But that doesn't
help me in any way.

My problem is, that I would like to delete the empty line if one of the
MERGE fields is empty. Now I get nasty spaces in the address section, if any
of my MERGE fields are empty.
Is there a way to use the IF THEN ELSE way, with this kind of merging? Or
could I run a macro after the merge is done, that will check all my
bookmarks and delete empty lines?

Best regards
Mads
 
P

Peter Jamieson

Unfortunately I don't have C5 and I suspect no-one else will be in a good
position to answer.

If C5 has created its own merge mechanism, I suspect that your only solution
will be to ask C5 for modifications that deal with Word 2003 properly.

However, if all they do is open a particular template, attach a particular
data source, and perform a standard mail merge, then
a. the problem is that in recent versions of Word, blank lines caused by
empty fields are not eliminated when those fields are nested within IF
fields and INCLUDETEXTed documents.
b. you can try doing this manually by putting the necessary paragraph marks
/inside/ the IF field results, using e.g.

{ IF "{ MERGEFIELD line1 }" <> "" "
{ MERGEFIELD line1 }" "" }{ IF "{ MERGEFIELD line2 }" <> "" "
{ MERGEFIELD line2 }" "" }

(i.e. where there is an ordinary paragraph mark immediately after the last "
on the first line).

Peter Jamieson
 
M

Mads W.

C5 uses a template and does a DLL merge where it uses bookmarks to search
where to fill in data.
So it doesn't really use MERGEFIELDS.
The merge only use bookmarks.
The DLL file is written to search for bookmarks, and if found fill in data
at the given bookmark.

Mads W.
 
P

Peter Jamieson

Does it do what you want it to do with /any/ version of Word?

Peter Jamieson
 
M

Mads W.

I'm using Word 2003. But it also works with Word XP and 2000.
I can upload the template and the DLL, if you can get any information out of
that?

Mads W.
 
P

Peter Jamieson

I can upload the template and the DLL, if you can get any information out

Can it be run standalone, i.e. without any other part of C5?

But what I really want to know is whether it works the way you want with any
version of Word. e.g. does it behave the way you want with Word 2002 but not
with Word 2003?

Peter Jamieson
 
M

Mads W.

It can't be run standalone.
And no, it does have the same flaw with all versions.

Mads W.
 
P

Peter Jamieson

OK, I doubt if you will be able to do anything with the data or with the
field layout that will make a difference, but I would try to find some way
to mark the document up so that you can easily do Find/Replace to remove
unwanted spaces and lines, /after/ the DLL has done its work (as long as it
is not printing stuff or e-mailing it straightaway).

For example, if their process leaves your bookmarks in place (I doubt if it
does though), you might be able to use VBA to check for bookmarks whose text
contains a single space and remove them. Or if you want to remove blank
lines, use one or more special paragraph style names (perhaps
RemoveMeIfBlank1, RemoveMeIfBlank2, and so on), then go through the document
removing empty or blank paragraphs with those names.

Peter Jamieson
 
M

Mads W.

My "unmerged" bookmarks remain in the generated document.
So writing a macro that finds the bookmark and deletes it, shouldn't be too
hard. But however, I would like to have this macro run without the user has
to do anything.

Mads W.
 

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