Jean-Guy
Tue Aug 01 09:06:11 CDT 2006
TimDouglas was telling us:
TimDouglas nous racontait que :
> Hi all,
>
> I have a macro which adds extra text into the table of contents, but
> for it to work correctly, the cursor needs to be placed at the end of
> the TOC. Is there a way I can get word to place the cursor there
> automatically, rather than making the user do it?
Dim rgePostTOC As Range
Set rgePostTOC = ActiveDocument.TablesOfContents(1).Range
With rgePostTOC
.Collapse wdCollapseEnd
End With
will place the range right after the TOC, then, if you are adding text, use
something like:
Dim rgePostTOC As Range
Set rgePostTOC = ActiveDocument.TablesOfContents(1).Range
With rgePostTOC
.Collapse wdCollapseEnd
.InsertAfter "New text"
End With
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site:
http://www.word.mvps.org