Edit an AddressBlock Field

How can one change an AddressBlock?  And why is it so hard to find such information?

I have an AddressBlock (was generated originally by the wizard):

{ADDRESSBLOCK \f "<<_TITLE0_ >><<_FIRST0_>><< _LAST0_>><< _SUFFIX0_>> <<_COMPANY_ >><<_STREET1_ >><<_STREET2_ >><<_CITY_>><<, _STATE_>><< _POSTAL_>><< _COUNTRY_>>" \l 1033 \c 1 \e "United States" \d }

Now I need to Add in #Unit after Street1, if there is a Unit value, otherwise leave it out.  How can I do this?

Answer
Answer

Further to Graham's post, you may need to suppress any spaces and other characters associated with the Unit field when it's empty. The simplest way of handling this is to add the \b or \f switch to the mergefield and insert whatever separates the two fields into that. For example, suppose you have:
«Unit»/«StreetNum»
and the «Unit» field is sometimes empty. Select and field and press Shift-F9. You should now see:
{ MERGEFIELD Unit }/«StreetNum»
Edit the Unit mergefield and delete the '/' after it, so you get:
{ MERGEFIELD Unit \f "/"}«StreetNum»
Then select the field and press F9 to update it. Word will now insert the Unit content and the '/' whenever the Unit field is not blank.

Similarly, suppose you want to have:
Unit «Unit», «StreetNum»
Naturally, you won't want 'Unit' appearing when there's no unit! In this case, you'd use both switches, as in:
{ MERGEFIELD Unit \b "Unit " \f ", "}«StreetNum»

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 142 Applies to: