![]() |
#1
|
|||
|
|||
![]()
I'm inserting some StyleRef/Seq fields into the first row of a table, but not sure how to tie the code together.
Code:
.Cell(Row:=1, Column:=1).Range.Text = "Table ?.?. Name of Table" Code:
Sub Macro1() Selection.Fields.Add Range:=Selection.Range, _ Type:=wdFieldEmpty, Text:="STYLEREF ""Heading 1"" \s", PreserveFormatting:=True End Sub Code:
Sub Macro2() Selection.Fields.Add Range:=Selection.Range, _ Type:=wdFieldEmpty, Text:="SEQ Table", PreserveFormatting:=True End Sub Also, from everything I've read, you need to use the switch \r 1 to restart the numbering in the next sequence block. So, let's say I have four tables under Heading 1, so those tables would be 1.1., 1.2., 1.3., and 1.4. Now under Heading 2, the table should start with 2.1. What would be the best way to handle this? I suppose a new macro would be required, but how to recognize the first table in a new Heading section? Code:
Sub Macro3() Selection.Fields.Add Range:=Selection.Range, _ Type:=wdFieldEmpty, Text:="SEQ Table \r 1", PreserveFormatting:=True End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Levi92 | Word | 6 | 10-21-2018 01:30 PM |
StyleRef field shows <> | Stoic | Word | 2 | 04-20-2017 04:42 AM |
![]() |
sj80 | Word | 1 | 01-26-2016 10:50 PM |
Problem using a StyleRef field in footer | sleake | Word | 10 | 06-27-2013 07:45 AM |
![]() |
Ulodesk | Word | 4 | 03-21-2012 11:15 AM |