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

Do the content controls preserve their name as you combine documents? Or do they continue to add number?

I have decided to go back to the search method. I will be allowing users to use some older forms that have the same content but are formatted differently. The find method allows them to do this. The below code works, but is not looping though each table in my document. I know this is basic VBA... but I am unable to get this to loop the whole document.

Code:
 
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Catagory 1"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
vCatagory1 = Selection.Text
Selection.Collapse
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Catagory 2:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
vCatagory2 = Selection.Text
Selection.Collapse
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Catagory 3"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
vCatagory3 = Selection.Text
Selection.MoveRight Unit:=wdCell
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
Entry:=vCatagory1 & ":" & vCatagory2 & ":" & vCatagory3, CrossReference:="", CrossReferenceAutoText:="", _
BookmarkName:="", Bold:=False, Italic:=False

Last edited by cksm4; 01-13-2011 at 07:58 PM.
Reply With Quote