Using IF statements to Insert a File

S

Sam

Hi All

I'm looking for some information/advice on writing an IF statement (or
whatever will work best) here is the back ground info:

I'm writing a mail merge document to send out to our vendors asking them to
sign on to our automated invoicing system. There are many different parts of
our company, with separate trading ABN's so I need to have the vendor sign a
separate legal document for each area.

I want to insert the relevant legal document into the letter depending on
whether or not the vendor detals with that area of our business.

E.g:
Vendor A deals with Iron Ore, Petroleum and Coal so I want to insert the
file for the legal document for each.

Vendor B deals with only Iron Ore and Petroleum so I only want to insert the
file for those 2.

I was trying to write an If statement along the lines of

{IF {MERGEFIELD A} = "Iron Ore" "{INCLUDETEXT "C:\RCTI\io.doc"
\*MERGEFORMAT}" ""}

But I'm not sure how to get this to look at all the different variables,
I've tried nesting the IF statements but it seems to get completely confused
and doesn't pull back the right data.

I'm using Excel 2003 as a data source and Word 2003 for the letter.

Thanks

Sam.
 
P

Peter Jamieson

As general rules,
a. double up backslashes in file paths in fields (c:\\RCTT\\io.doc) (or you
may find using single forward slashes works better). Also, unchecking Word
Tools|Options|General|Web Options|Files|Update links on save can prevent
Word from changing paths in some field types)
b. remove \*Mergeformat (unless it is the only thing that makes your
includetexts work) and ensure that you do not have formatting/style clashes
between your including and included documents (e.g. if you have a style
called "abc", it should bedefined the same way in both documents)
c. you may need to eliminate the final paragraph mark (which contains
section formatting) in your included files, by marking the entire file
except the final paragraph mark with a bookmark - called say, "almostall".
Then use

{ INCLUDETEXT "C:\\RCTI\\io.doc" almostall }

c. nest the other way around, e.g.

{ INCLUDETEXT "{ IF "{ MERGEFIELD A }" = "Iron Ore" "C:\RCTI\io.doc" "some
other path name with an empty document" }" almostall }

(Obviously, you have to get your IF field logic right as well!)

Peter Jamieson
 

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