![]() |
#3
|
|||
|
|||
![]()
Hey Paul,
Thanks again for replying. I worked on this last night and made a little progress. As you can see below I set the selected text to a variable: Selection.Find.ClearFormatting With Selection.Find .Text = "Level 1" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveRight Unit:=wdCell vCatagory1 = Selection.Text Selection.Collapse Selection.Find.ClearFormatting With Selection.Find .Text = "Level 2" .Replacement.Text = "" .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveRight Unit:=wdCell vCatagory2 = Selection.Text Selection.Collapse Selection.Find.ClearFormatting With Selection.Find .Text = "Level 3" .Replacement.Text = "" .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveRight Unit:=wdCell vCatagory3 = Selection.Text Selection.GoTo What:=wdGoToBookmark, Name:="IndexThis" ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _ Entry:=vCatagory1 & ":" & vCatagory2 & ":" & vCatagory3, CrossReference:="", CrossReferenceAutoText:="", _ BookmarkName:="", Bold:=False, Italic:=False This creates a three level index based on the values of the three fields. It works but I am back to the loop issue as this code needs to run for each document. My final document is a combination of mutiple forms (page breaks between) filled out by the user. I can run this code on each form as it is created, but I prefer to run it just once after the final combination is complete. I am struggling with the transition from the first search to the "Do While" and have not been able to get it to work. Brock |
Thread Tools | |
Display Modes | |
|
![]() |
||||
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 |