Problem with Word - Help!

A

Andrew

I have a word document with a random # of tables inside it. I want a script
which will automatically find all the tables and insert a new blank column
before column #3


does anyone know of any, or a place to to find them.

Can you please e-mail me the answer to (e-mail address removed)

thanks Andrew
 
B

bubba

Sub AddColumn()

Dim myTable As Table

For Each myTable In ActiveDocument.Tables
'From Help on Add/Example with Columns
Set newCol = myTable.Columns.Add(BeforeColumn:=myTable.Columns(3))
newCol.SetWidth ColumnWidth:=InchesToPoints(0.5), _
RulerStyle:=wdAdjustNone
Next

End Sub
 
A

Andrew

Sub AddColumn()

Dim myTable As Table

For Each myTable In ActiveDocument.Tables
'From Help on Add/Example with Columns
Set newCol = myTable.Columns.Add(BeforeColumn:=myTable.Columns(3))
newCol.SetWidth ColumnWidth:=InchesToPoints(0.5), _
RulerStyle:=wdAdjustNone
Next

End Sub

"Many thanks, works awesome!!! Could I ask another question... Is there a
way I can delete specific tables from within the same document which
contain a certain word?

E.g. do a find for "test" and then if it is found, delete the table it is
inside??"
 

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