Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2000 If - then- else delete line formula 1

Status
Not open for further replies.

stubnski

MIS
Nov 17, 2005
403
US
Hi experts

Is there a formula that will say
If address2 ="" then delete this line else address2.

It is for a mail merge. The program that I need to use connects to Word, but it will not use the suppress blank lines when merging option. So I have a blank line in the members address on some records that I need to delete.

Hope this is enough information.

Also can anyone recomend any sites or books for programming in Word.

TIA

Stubnski
 


Hi,

VBA Visual Basic for Applications (Microsoft) Forum707.

Several contributors are quite proficient in Word VBA

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Hi Stubnski,

I'm confused. Is this a Word Mail Merge or not? I don't understand why, if you can run VBA in Word, you can't use Word features, including suppressing blank lines.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hi Tony thanks for the reply!

I use a banking program that queries our database. It then automatically merges the info(members address) thru a template I have set up.

The weird thing is that if there is no data in one of the fields it doesn't suppress the blank line. It's not Words problem its the other program. I have talked to the vender to get it resolved in future updates, which could be awhile depending on the urgency level(very low for this one).

I do not know why it will not use the settings I have set up for the mail merge. So I'm trying to figure out how to hard code suppressing the blank mail merge field into the template.

I hope that makes sense.

Stubnski
 
Hi stubnski,

You can fix this by embedding your MERGEFIELD in an IF field. To do this:
. copy your existing Address2 MERGEFIELD and paste it next to the existing one
. select both Address2 MERGEFIELDs and press Ctrl-F9 to wrap them in another field, thus:
{«Address2» «Address2»}
. fill in between the new field braces and existing Address2 MERGEFIELDs thus:
{IF«Address2»= "" "" "¶«Address2»"}
where '¶' is a paragraph mark or line feed. Pay particular attention to the spacing.
. delete the paragraph mark/line feed following your Address1 MERGEFIELD
. run your mailmerge.

Cheers

[MS MVP - Word]
 
Macropod I can't thank you enough [thumbsup2]

Can you recommend any sites or books on this sort of stuff.

Thanks again

Stubnski
 
Hi Stubnski,

You're welcome.

I don't actually know of any books I could recommend on mailmerges. Not because there aren't any, it's just that I haven't spent any time reading them.

On the more generalised topic of Word field maths, and the specialised topic of Word date calculations, I've produced two tutorials with practical examples you can download from:
and:
respectively.

Cheers

[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top