View Single Post
 
Old 06-28-2017, 01:33 AM
AHKpie AHKpie is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jun 2017
Posts: 7
AHKpie is on a distinguished road
Default vba newb problem

Hello dear VBA programmers,

If I execute the next Macro1 in the document I am working in, I get the index I want printed in the same document.
What codes do I have to add if I want to select and copy only the index?
(The printed index is good but I want paste the result in a new empty document)
Many thanks in advance.

Sub Macro1()
ActiveDocument.TablesOfContents.Add Range:=Selection.Range, _
RightAlignPageNumbers:=True, _
UseHeadingStyles:=True, _
UpperHeadingLevel:=1, _
LowerHeadingLevel:=5, _
IncludePageNumbers:=True, _
AddedStyles:="", _
UseHyperlinks:=True, _
HidePageNumbersInWeb:=True, _
UseOutlineLevels:=True
End Sub
Reply With Quote