Word VBA coding for tables
Help needed please with coding below, currently this works but only if i dont have any tables in the document. I want to be able to continually use macro to add different tables within same document, think its something to do with activedocument.tables (1), how do i name the table if i don't want it to be a set number?
Sub TestCGBT()
Dim oTbl As Table
' TestCGBT Macro
Application.Templates("P:\Templates\CG Research Template.dotm"). _
BuildingBlockEntries("CG body text table").Insert Where:=Selection.Range, _
RichText:=True
ActiveDocument.Tables(1).Cell(1, 1).Range.Select
Selection.SplitTable
Application.Templates("P:\Templates\CG Research Template.dotm"). _
BuildingBlockEntries("Figure 1: Title").Insert Where:=Selection.Range, _
RichText:=True
Selection.Delete Unit:=wdCharacter, Count:=1
Dialogs(wdDialogTableInsertTable).Show
End Sub
|