textbox positioning on a vertically centered page via VB-6

G

Garrett Manahan

I am having problems getting the positioning of a textbox correct when adding
it to a vertically centered page. It seems that no matter what I do, the
vertical(top) positioning of the textbox always is pushed down the page so
that it is even with the first paragraph on the page. It doesn't matter if
it is positioned by page or margin. The textbox is being added in VB 6 using
the 'AddTextBox' method... I can go into Word and add a textbox manually
without any problem...but via automation...forget it. I used to have similar
problems when the anchor of the textbox was within a table cell, but the
'LayoutInCell' property in 2003 took care of that. Anyone have any ideas?
 
J

Jean-Guy Marcil

Garrett Manahan was telling us:
Garrett Manahan nous racontait que :
I am having problems getting the positioning of a textbox correct
when adding it to a vertically centered page. It seems that no
matter what I do, the vertical(top) positioning of the textbox always
is pushed down the page so that it is even with the first paragraph
on the page. It doesn't matter if it is positioned by page or
margin. The textbox is being added in VB 6 using the 'AddTextBox'
method... I can go into Word and add a textbox manually without any
problem...but via automation...forget it. I used to have similar
problems when the anchor of the textbox was within a table cell, but
the 'LayoutInCell' property in 2003 took care of that. Anyone have
any ideas?

Show us the code you are using to insert/position the textbox.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Garrett Manahan

Other than the calculations for the positioning, the call is quite simple...

Set Word_TextBox =
Word_Document.Shapes.AddTextbox(msoTextOrientationHorizontal, Left, Top,
Width, Height, Document_Section.Range)

After some more research, it appears to actually add it fine to start off
with. But the next page happens to start a new section, so as soon as I add
that section break in there, the textbox shifts. I think it may have
something to do with the page header. The page header expands on vertically
centered pages to the top of the first paragraph. I have been told that this
is just a graphical thing and that the header isn't really that big...but I
don't know as I believe it.

Also, as a test, open a new Word document(manually, not via automation),
center the first page and then add a textbox anywhere on the page. It's
initial positioning may or may not come out as you have specified, but now
try and move that textbox some where else on the page. The darn thing, at
least for me, jumps all over the place. It won't let you reposition it where
you want it. Some times it jumps completely off the page. Take the vertical
centering off and it works fine. It's even worse if you bottom justify the
page.

Thanks,

Garrett
 
J

Jean-Guy Marcil

Garrett Manahan was telling us:
Garrett Manahan nous racontait que :
Other than the calculations for the positioning, the call is quite
simple...

Set Word_TextBox =
Word_Document.Shapes.AddTextbox(msoTextOrientationHorizontal, Left,
Top, Width, Height, Document_Section.Range)

After inserting it, have you tried positioning the textbox relative to page,
and not relative to a paragraph range?
0" relative to page for Vertical and (page width/2 + textbox width)"
relative to page for Horizontal.
It might also help to make sure there is no wrapping.
After some more research, it appears to actually add it fine to start
off with. But the next page happens to start a new section, so as
soon as I add that section break in there, the textbox shifts. I
think it may have something to do with the page header. The page
header expands on vertically centered pages to the top of the first
paragraph. I have been told that this is just a graphical thing and
that the header isn't really that big...but I don't know as I believe
it.

If you use a section with vertical central alignment, and if the shape is
positioned at some offset relative to the page or the paragraph, Word will
push the shape down and place it starting with the new beginning of the
vertical page, depending on the amount of text, this "beginning" may vary.



--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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