View Single Post
 
Old 12-16-2019, 04:32 PM
jeffreybrown jeffreybrown is offline Windows 10 Office 2016
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Thanks Andrew. That seq field setup works great. I created the string...

Quote:
Table {StyleRef 1 \s}.{Seq Table \s 1}
and then saved it as a building block call Table.

Code:
Sub InsertAutoTextEntry()
ActiveDocument.AttachedTemplate.BuildingBlockTypes(1).Categories("General").BuildingBlocks("Table").Insert Where:=Selection.Range, RichText:=True
End Sub
With this code I get a runtime error 5941. If I record the action, I get...

Code:
Sub Macro1()
    Application.Templates( _
        "C:\Users\jeffb\AppData\Roaming\Microsoft\Document Building Blocks\1033\16\Building Blocks.dotx" _
        ).BuildingBlockEntries("Table").Insert Where:=Selection.Range, RichText:=True
End Sub
Not sure what step I am missing?
Attached Images
File Type: jpg Capture.JPG (24.6 KB, 19 views)
Reply With Quote