Thread: [Solved] Save Selection
View Single Post
 
Old 01-13-2011, 02:33 PM
cksm4 cksm4 is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Aug 2010
Posts: 48
cksm4 is on a distinguished road
Default

Hey Paul,

The bookmark will no longer work because as documents are combined, it just keeps getting replaced. I used the below code to go to the next row to input the index.

Code:
 
Dim strTmp As String, iSctn As Integer
iSctn = InputBox("Which Section to process?")
If iSctn = "" Then Exit Sub
With ActiveDocument.Sections(iSctn).Range
  strTmp = .ContentControls(2).Range.Text
  strTmp = strTmp & ":" & .ContentControls(4).Range.Text
  strTmp = strTmp & ":" & .ContentControls(3).Range.Text
  Selection.MoveRight Unit:=wdCell
  ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
    Entry:=strTmp, CrossReference:="", CrossReferenceAutoText:="", _
    BookmarkName:="", Bold:=False, Italic:=False
End With
Would it also be possible to have the code run the whole document automatically as opposed to allowing the user to select sections?
Reply With Quote