Could somebody provide me with a code sample to show how to create a table
within a table cell?
Thanks in advance
Andy
Sub CreateTableInTable()
Dim oTable As Table
Set oTable = Selection.Cells(1).Tables.Add _
(Range:=Selection.Cells(1).Range, numrows:=3, numcolumns:=5)
'Now you can manipulate oTable, e.g. insert text
oTable.Cell(1, 1).Range.Text = "My text"
Set oTable = Nothing
End Sub
Depending on how your code is going to be used, you may need to include
error handling. For example, you may need to check whether the selection
start is in a table.
--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word