![]() |
#1
|
|||
|
|||
![]()
Hi,
I am trying to insert a TC marker as part of a macro. It is inserting the TC marker correctly with the text I want but unfortunately doesn't seem to pick up the number which is applied to the current paragraph. The parapraph that I am applying my macro to is using a style which is in a multilevel list and has number '1' set. I followed Shauna's guide for setting up the numbering and it works really well. As an example it looks like this (with proper alignment!) Code:
1 Some text here 2 Some more text Code:
1 Some text here { TC "1 Some Text here" \f C \l "1" } 2 Some more text What I actually get is (note the omission of the '1') Code:
1 Some text here { TC "Some Text here" \f C \l "1" } 2 Some more text Some code with comments may help to explain a bit more: Code:
Dim myRange As Range myRange = Selection.Paragraphs(1).Range Dim thisPara as String Dim currentNumber as String Dim spaceChar as String Dim tcText as String spaceChar = " " ' This is the current paragraph's text thisPara = myRange ' I expected to be able to get the current number using the line below. But it's always blank. It doesn't even return "nothing" like the documentation says it should. I've tried calling it directly as well (e.g Selection.Paragraphs(1).Range.ListFormat.ListString) currentNumber = myRange.ListFormat.ListString ' Some concatenation... tcText = currentNumber & spaceChar & thisPara ActiveDocument.TableOfContents.MarkEntry Range:=myRange, Entry:=tcText, Level:=1 Does anyone know what I am doing wrong? Happy to provide more information if needed but I think there is enough information in my post. Thanks ![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jeffreybrown | Word VBA | 7 | 10-19-2019 01:15 PM |
![]() |
gugootz | Word | 1 | 11-23-2015 04:58 PM |
![]() |
spthomas | Word | 12 | 12-16-2013 05:23 PM |
![]() |
nattasiray | Word | 2 | 12-16-2011 08:01 PM |
Numbered List paragraph style prints out incorrectly when converted to PDF - Help! | kimrussell68 | Word | 0 | 02-02-2010 07:58 AM |