Center text in current page

J

juan

Hello:
I have generated a Word document from code with Visual Basic 2005. I'm using
Word 2003. I want to center a title in the first page (two lines), but only
in this page. I have tried a few method but they didn't work properly. Any
idea?
Thanks.
 
N

NZ VBA Developer

It depends on if you want to centre the text horizonally or vertically.

To centre horizontally, just set the Alignment property of the title
paragraphs to wdAlignParagraphCenter.

To centre vertically, insert a section break after the title and then set
the vertical alignment of the section to centred using something like this:

ActiveDocument.Sections(1).PageSetup.VerticalAlignment=wdAlignVerticalCenter

Of course this is greatly simplified, but at least it gives you an idea of
what objects and properties to look at.
--
Cheers!
The Kiwi Koder

Please note: Uninvited email contact will be marked as SPAM and ignored -
unless you want to hire me. ;-)
 

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