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 / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Create tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lasse - 28 Jun 2007 12:40 GMT
Hi

I need to create a macro that inserts a table with 3 columns and 4 rows. The
problem is not creating the table with 3 columns and 4 rows, the problem is
how to define the size (or column width) of each column.
If I try to record a new macro I am not allowed to change the table
properties.

Does anyone have a solution to this problem?
David Sisson - 28 Jun 2007 14:18 GMT
Hi Lasse,

Sub SetupTable()

Dim aDoc As Document
Dim aTable As Table

Set aDoc = ActiveDocument

Set aTable = aDoc.Tables.Add(Range:=Selection.Range, NumRows:=5,
NumColumns:=5)

With aTable
   .Columns(1).Width = InchesToPoints(1.75)
   .Columns(2).Width = InchesToPoints(1.5)
   .Columns(3).Width = InchesToPoints(1.25)
   .Columns(4).Width = InchesToPoints(1)
   .Columns(5).Width = InchesToPoints(1.5)
End With

End Sub
 
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.