#1
|
|||
|
|||
Inserting a table using ADD command
I have a word template where I added a table to Quick Parts / Part Gallery. I also added a command button with code behind. Now when I click the ADD button it inserts a new table in the form and that is what I want. When it display the inserted table it also gives an error:
Table Error! No text of specified style in document.‑1 <Table Title> Not sure what this is and how to correct. Thank you. Code behind the ADD button: Code:
Private Sub CommandButton1_Click() With CaptionLabels("Table") .NumberStyle = wdCaptionNumberStyleArabic .IncludeChapterNumber = True .ChapterStyleLevel = 1 .Separator = wdSeparatorHyphen End With Selection.InsertCaption Label:="Table", TitleAutoText:="", Title:="", _ Position:=wdCaptionPositionAbove, ExcludeLabel:=0 Selection.TypeText Text:=" <Table Title>" Selection.TypeParagraph ActiveDocument.AttachedTemplate.BuildingBlockEntries("corporate_table" _ ).Insert Where:=Selection.Range, RichText:=True End Sub |
#2
|
|||
|
|||
Toggle field codes in your document after you run the code. There error is due to the StyleRef 1. You probably don't have any Heading 1 style applied in your document that is linked to a Level using a Multilevel list.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Inserting Images/Pictures into Table of Content | Simon | Word | 11 | 09-12-2016 11:37 PM |
Inserting arrow images into a table | jklein | Word Tables | 5 | 06-29-2014 07:40 PM |
Inserting table | natasha_arriell | Mail Merge | 4 | 06-04-2014 12:13 AM |
Inserting landscape Table into Portrait Document | sstark | Word Tables | 2 | 02-13-2013 08:43 AM |
Inserting a table | Katelyn | Outlook | 0 | 04-05-2012 09:39 AM |