222 Posted April 29, 2005 Report Share Posted April 29, 2005 Sub СуперПоиск() ' Макрос1 Макрос ' Макрос записан 11.04.05 Mikhail ' Dim What As Integer '1 обозначает предложение What = 1 С.Show If С.ObjFind1.Value = True Then What = 1 Else If С.ObjFind2.Value = True Then '2 обозначает абзац What = 2 Else If С.ObjFind3.Value = True Then '3 обозначает слово What = 3 Else End If End If End If If (С.TextBox1 = "") Then Exit Sub End If With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="dody" .DefaultSorting = wdSortByName .ShowHidden = True End With If С.CheckBox1.Value = True Then Selection.HomeKey Unit:=wdStory End If Selection.MoveRight Selection.MoveLeft If What = 1 Then Selection.Find.ClearFormatting With Selection.Find .Text = С.TextBox1.Text .Forward = True .Wrap = wdFindStop End With Do While Selection.Find.Execute If С.TextBox2 = "" Then Exit Sub End If Selection.MoveLeft Selection.MoveRight Selection.MoveLeft Unit:=wdSentence Selection.MoveRight Unit:=wdSentence, _ Count:=1, Extend:=wdExtend AAA = Selection.Text If (InStr(AAA, _ С.TextBox2.Text)) Then Exit Sub End If Selection.MoveRight Unit:=wdCharacter Loop End If If What = 3 Then Selection.Find.ClearFormatting With Selection.Find .Text = С.TextBox1.Text .Forward = True .Wrap = wdFindStop End With Do While Selection.Find.Execute If С.TextBox2 = "" Then Exit Sub End If Selection.MoveLeft Selection.MoveRight Selection.MoveLeft Unit:=wdWord Selection.MoveRight Unit:=wdWord, _ Count:=1, Extend:=wdExtend AAA = Selection.Text If (InStr(AAA, _ С.TextBox2.Text)) Then Exit Sub End If Selection.MoveRight Unit:=wdCharacter Loop End If If What = 2 Then Dim i As Single i = 1 HHH = 500 Selection.Find.ClearFormatting With Selection.Find .Text = С.TextBox1.Text .Forward = True .Wrap = wdFindStop End With Do While (Selection.Find.Execute) And (i < HHH) If С.TextBox2 = "" Then Exit Sub End If Selection.MoveLeft Selection.MoveRight With Selection.Find .Text = "^p" .Forward = False .Wrap = wdFindStop End With If Selection.Find.Execute Then Selection.MoveRight Unit:=wdCharacter Selection.ExtendMode = True With Selection.Find .Text = "^p" .Forward = True .Wrap = wdFindStop End With Selection.Find.Execute AAA = Selection.Text Selection.ExtendMode = False If (InStr(AAA, _ С.TextBox2.Text)) Then Exit Sub End If Else MsgBox "Нашли в первом абзаце." Exit Sub End If Selection.MoveRight Unit:=wdCharacter Selection.Find.ClearFormatting With Selection.Find .Text = C.TextBox1.Text .Forward = True .Wrap = wdFindStop End With i = i + 1 Loop End If MsgBox "Искомые элементы не найдены." Selection.GoTo What:=wdGoToBookmark, Name:="dody" ActiveDocument.Bookmarks("dody").Delete End Sub Link to comment Share on other sites More sharing options...
Shurr Posted April 29, 2005 Report Share Posted April 29, 2005 222 помогите составить блок-схему Что в твоем понятии "помогите"? Составьте ее за меня? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now