Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / February 2005

Tip: Looking for answers? Try searching our database.

HowTo: Align Tablecolumn

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulrich - 27 Feb 2005 17:00 GMT
Hi,

how can i (right-)align a table's column in vb?

I use the following code:

Set Tbl = WordDoc.Tables.Add(somRange, intRows, intCols)

Tbl.Cell(iRow, iCol).Range.Text = someText

Now i want to right-align or center one of the columns icol. Using the table
or selection range-method .Rows.Alignment=wdAlignRowRight does not work!
What do i do wrong?

Please help me someone. Thanks.
Pat Garard - 28 Feb 2005 02:57 GMT
G'Day Ulrich,

Try this:

Sub ColumnAlign()
' Using your sample code.....
   Set Tbl = WordDoc.Tables.Add(somRange, intRows, intCols)
   ' You have put some text into a cell
   Tbl.Cell(iRow, iCol).Range.Text = someText

   ' We have NO IDEA where the insertion point is at this time....
   '....so select the text we inserted....
   Tbl.Cell(iRow, iCol).Range.Select

   ' Now that the Insertion Point is in that same Cell - Select the
Column.....
   Selection.SelectColumn
   ' ....and Format It
   Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
End Sub
Signature

Regards,
Pat Garard
Melbourne, Australia
_______________________

> Hi,
>
[quoted text clipped - 12 lines]
>
> Please help me someone. Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.