Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-16-2019, 03:26 PM
jeffreybrown jeffreybrown is offline Insert StyleRef and Seq field into text Windows 10 Insert StyleRef and Seq field into text Office 2016
Expert
Insert StyleRef and Seq field into text
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Insert StyleRef and Seq field into text

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
I would like the above two macros to fill in in the place of the question marks in the first code block.

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

Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert StyleRef and Seq field into text Styleref field returns error Levi92 Word 6 10-21-2018 01:30 PM
StyleRef field shows <> Stoic Word 2 04-20-2017 04:42 AM
Insert StyleRef and Seq field into text Insert text form field help 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
Insert StyleRef and Seq field into text StyleRef field Ulodesk Word 4 03-21-2012 11:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft