Prev: List of fonts used in a Word doc -- the easy way
Next: after input, IF THEN to compare 2 #s & select answer fm a table
From: Jay Freedman on 28 Feb 2010 18:31 Before the "With Selection.Find" statement, define a Range object that will store the original Selection's location: Dim myRange As Range Set myRange = Selection.Range At the end of the code you showed, select that Range object: mYRange.Select -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. On Sun, 28 Feb 2010 15:06:31 -0800 (PST), andreas <andreas.hermle(a)gmx.de> wrote: >Dear Experts: > >For some specific reasons I am using the Selection Object for a search >operation. > >below macro searches for two or more consecutive tab stops. The >trouble is, if an occurrence of two consecutive tab stops is found the >initial selection is reduced to the length of the first occurrence. > >Is it possible to preserve the initial selection and re-activate it >after the first occurrence of two or more consecutive tab stops? > >Help is much appreciated. Thank you very much in advance. > >Regards, Andreas > >Selection.Find.ClearFormatting >Selection.Find.Replacement.ClearFormatting > With Selection.Find > .Text = "^t{2;}" > .Forward = True > .Wrap = wdFindStop > .MatchWildcards = True > End With > Selection.Find.Execute > If Selection.Find.Found Then > If MsgBox("Consecutive Tab Stops found! Would you like to >continue?", vbCritical, "Consectutive Tab Stops found!") = vbNo Then > Exit Sub > End If >Else .... (The initial selection should be re-activated) |