Solved: Word 2003 - change column widths in a table - help!

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

BECA

Thread Starter
Joined
Dec 6, 2011
Messages
2
(I am reposting retroboy17's question, since I went to answer it and this forum had closed the thread due to inactivity.)
Hey everyone,
I am only familiar with the basics in Word (I am a bit better with Excel) but I have encountered a problem that I am hoping for some help with at work: I am handed over a Word 2003 document every monday morning that is roughly 5-9 pages long that consists of roughly 5-7 tables on it. All 6 tables have 6 columns with identical headings for each. Every Monday, I spend a lot of time making these into the exact same format, adjusting column widths to the exact same specs. I created a macro to make all of my adjustments but it fails when it comes time to adjust the column widths for all the tables. I would like to be able to run a macro with the columns widths to finish as follows:

column 1: .73
column 2: .35
column 3: .66
column 4: .51
column 5: .38
column 6: 7.56

Please help me get to the bottom of this to save my Mondays!
Thanks!
 

BECA

Thread Starter
Joined
Dec 6, 2011
Messages
2
From what I’ve seen, Word 2003 doesn’t let you iterate through columns like you would in Word 2007. So, when writing this as a 2003 macro, you have to brute force it. This has worked for me (this assumes that you have already set the table width to the sum of all of these columns):

Dim t As Table
For Each t In ActiveDocument.Tables
t.Cell(1, 1).Select

Selection.Expand Unit:=wdColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.73)
Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.Expand Unit:=wdColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.35)
Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.Expand Unit:=wdColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.66)
Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.Expand Unit:=wdColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.51)
Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.Expand Unit:=wdColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(0.38)
Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.Expand Unit:=wdColumn
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = InchesToPoints(7.56)
Selection.MoveRight Unit:=wdCharacter, Count:=1

Next t
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top