Anchoring text boxes on the first paragraph of a page

S

Sol Apache

I have macros to insert three text boxes in different positions on the
current page along the left or right margin. Because they are anchoring
themselves to the nearest paragraph which could be deleted while editing
I¹d like to anchor them to the the first paragraph of the page in the hope
that such an anchor is more stable.

If I use this line:

MyTBox.Anchor = ActiveDocument.Paragraphs(1).Range

the text box is placed on the first page of the document and in the bottom
margin of the first page - nowhere near the position I have stated in the
macro (why does it ignore the top and left positions in the macro just
because it is anchored to the first paragraph of a document?). I have tried
variations on this line of code but VB just gives me error messages, mostly
³object not found².

I cannot find code for anchors on the top paragraph of a current page, so
can someone help me with this?

Also can more than one anchor be placed on the same paragraph.

Any help much appreciated.


Sol
 
J

Jezebel

You could anchor them to the header or footer to minimise the chance of them
being deleted inadvertently. They can still be positioned anywhere on the
page.

The positioning problem has nothing to do with the paragraph to which they
are anchored unless you have set the position to be relative to the anchor
paragraph. You need it to be absolute, relative to the page. You also need
to make sure that the textboxes aren't interfering with each others'
positions (eg allow overlap etc). And it would be wise to lock the anchor.

Yes, you can have more than one object anchored to the same paragraph.
 
S

Sol Apache

Thanks Jezebel. I cannot set the empty text boxes to the header and footer
as it will make it too difficult for the template users to put anything in
and move them around as they¹ll have to open the header/footer.

They are side text boxes, inserted on demand, for putting in text, pull
quotes or pictures, etc as illustrations to the main text and will always
require some manipulation. (Ideally such a template should be in Quark or
InDesign, but the client wants it in Word.)

I can ensure that the position is absolute but I do not know how to have all
the text boxes absolutely anchored to the first paragraph. Can anyone help
me with this?

Thx


Sol
 
J

Jezebel

Drag the anchors to the first paragraph, then lock the anchors. As long as
the first paragraph is not deleted, your textboxes will remain present and
in place.
 
S

Sol Apache

Hi Jezebel

I know how drag anchors manually, but the textboxes are inserted by macro.
They are not on the template or the document until the user clicks on a
toolbar button for a ³top left² text box, or a ³middle right² text box, etc.

What I don¹t know is the code for positioning a text box on the top
paragraph of a page so I can put this code into each relevant macro, and I
haven¹t been able to find it searching through VB help (Mac) or through
various VB newsgroups.

Thx

Sol
 
C

Cindy M.

Hi Sol,
What I don¹t know is the code for positioning a text box on the top
paragraph of a page so I can put this code into each relevant macro, and I
haven¹t been able to find it searching through VB help (Mac) or through
various VB newsgroups.
Make sure the current selection is on the page in question. then

Dim rng as Word.Range
Dim rngPara as Word.range
Set rng = ActiveDocument.Bookmarks("\Page").Range
Set rngPara = rng.Paragraphs(1).Range

But you want to test this with paragraphs that break across pages, as these
might throw off the result, depending on what result you need. You may need,
in addition, to check whether the first and last characters in the paragraph
range are on the same page.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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