How Can I Right-Align a Single Column in a Word Table?
Hey, Scripting Guy! Question
Hey, Scripting Guy! How can I right-align a single column in a Word table?
-- RC
SpacerHey, Scripting Guy! AnswerScript Center
Hey, RC. You know, one of the phrases no one ever wants to hear is “This isn’t as bad as it looks.” After all, that’s what your business partner says when you discover he’s been using the company payroll to buy lottery tickets. “This isn’t as bad as it looks,” is the phrase a doctor uses when you catch a glimpse of the hypodermic needle he’s preparing to stick you with. (In that case, he’s right: it’s usually worse than it looks.) And yes, “This isn’t as bad as it looks” is the phrase that the Scripting Guys use before showing you a script that right-aligns a column in a Microsoft Word table.
The difference, of course, is that we Scripting Guys sincerely mean it. As you’re about to see, it takes only a few lines of code to right-align a table column in Word. The only problem is that it’s difficult to right-align a table column unless you actually have a table in your document. For better or worse, creating a table in Word - while not especially hard - does require a relatively large amount of code, especially if you want to create a table that resembles the sort of table a system administrator might create. So relax. The script will look big and it will look complicated, but the part you’re interested in is very easy.
Answered by
Mohd Farooq
, an ibibo Master,
at
5:30 PM on May 03, 2008