![]() |
|
#1
|
|||
|
|||
![]()
Hey Paul,
Quote:
Each document will always have the wording "Category 1" near the top of the document. Since I will be combining the documents into one document prior to running the below code, I decided not to use a bookmark to place the index. I just have the code go the next row after the last category is found and paste the index there. This next row is blank and can be used for this. Code:
Selection.Find.ClearFormatting With Selection.Find .Text = "Category 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 = "Category 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 = "Category 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.MarkEntryRange:=Selection.Range, _ Entry:=vCatagory1 & ":" & vCatagory2 & ":" & vCatagory3, CrossReference:="", CrossReferenceAutoText:="", _ BookmarkName:="", Bold:=False, Italic:=False I would be nice to also limit the code to sections so that if somehow it found "Category 1" and not "Category 2" it does not go to the next section (another form) looking for "Category 2". Just me being cautious! Quote:
I can use code to find ContentControl(1) because I will be combining multiple of these forms into one document prior to running this code. It is my understanding then that after I do this, the code will only find one ContentControl(1)... the one on the last form. The ones on all the rest of the forms will rename. Thanks again Paul! |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Textbox updating from combobox selection | paxile2k | Word VBA | 0 | 10-26-2010 02:30 PM |
Document selection procedure | kennethc | Word | 0 | 09-15-2010 02:56 PM |
The modification is not allowed because selection is locked | aligahk06 | Word | 0 | 09-06-2010 06:28 AM |
Automatic find replace after selection in dropdown | vsempoux | Word | 0 | 10-28-2009 08:45 AM |
Highlighted Selection on Action Settings | mos7sad | PowerPoint | 0 | 10-12-2009 07:48 AM |