N
npacker
I have been coding a document to automate the splitting of a table and
inserting a line that captures the Heading 1 number and the Heading 1
Text plus the word continued. At the location where I want to split the
table and insert the text, I run the code and it works just how I want
it. Example:
2.0 Some Heading Text, Continued
The very next time I run the code - farther down in the table, the
exact same code produces this,
, Continued Some Heading Text2.0
The code has reversed the text.
I can insert the next Heading 1, and again the code works just fine in
the table under this new Heading 1, but reverses at the next call of
the code. In the paragraph produced at the table split, the following
code creates the fields and the text.
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="StyleRef 1 \n"
Application.Run MacroName:="Project.Called.UpdateFields"
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="StyleRef 1\t"
Application.Run MacroName:="Project.Called.UpdateFields"
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=", Continued"
Selection.Style = ActiveDocument.Styles("TableSplitCont")
Incidently, I had it working just fine just including the Heading text,
but the client wants the Heading number to appear also.
Any ideas on how I can keep the text in the correct order? Am I missing
something with the coded StyleRef field?
Nathan
inserting a line that captures the Heading 1 number and the Heading 1
Text plus the word continued. At the location where I want to split the
table and insert the text, I run the code and it works just how I want
it. Example:
2.0 Some Heading Text, Continued
The very next time I run the code - farther down in the table, the
exact same code produces this,
, Continued Some Heading Text2.0
The code has reversed the text.
I can insert the next Heading 1, and again the code works just fine in
the table under this new Heading 1, but reverses at the next call of
the code. In the paragraph produced at the table split, the following
code creates the fields and the text.
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="StyleRef 1 \n"
Application.Run MacroName:="Project.Called.UpdateFields"
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="StyleRef 1\t"
Application.Run MacroName:="Project.Called.UpdateFields"
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=", Continued"
Selection.Style = ActiveDocument.Styles("TableSplitCont")
Incidently, I had it working just fine just including the Heading text,
but the client wants the Heading number to appear also.
Any ideas on how I can keep the text in the correct order? Am I missing
something with the coded StyleRef field?
Nathan