Trying to move label control using VBA

B

B K S

I have a Word 2003 document that allows users to select a location
from a drop-down list to pre-populate the letterhead with the correct
address. The letter is used for several companies within our
organization. After making the selection from the drop-down list, the
company name gets loaded into one label control with bold formatting,
and the address gets loaded into a second label control directly below
the company name.

Some of the international addresses have more lines in them than the
domestic addresses, and I want the last line to line up with a graphic
on the letterhead. Since the company names and addresses are in two
separate label controls, bottom-alignment causes blank spaces under
the company name. It appears that my best solution is to determine
how much vertical space the address will require, then move the label
controls accordingly so the bottom lines up with the graphic. I
attempted to combine the label controls, but it appears I cannot use
multiple formats within the same control (which would also solve my
problem).

I found some information for programmatically placing shapes in Word,
but I have not been able to use the code for the label control. Does
anyone have sample code to place the label control relative to the top
of the page?

For what it's worth, the document must remain backward compatible with
Word 2000.

Thanks in advance!
 
D

Doug Robbins - Word MVP

I think that you are going about it the wrong way.

You should set up the graphic and the company name and address in the cells
of a one row table with the text alignment set to bottom (probably left)

I would then use document variable fields to hold the hold the company name
and another one for the address.

You should of course be using a userform for this, not a dropdown formfield
as used in a protected document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - 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