litceysel.ru
добавить свой файл
  1 ... 13 14 15 16 17 18 19

Полуфабрикаты макросов для выполнения задания

Sub СтильДляАбзаца1()

'

' СтильДляАбзаца1 Макрос

' Макрос записан 01.04.2003 Grom

'

If MsgBox("Открыть документ?", vbYesNo) = vbYes Then Dialogs(wdDialogFileOpen).Show

MsgBox "Информация к размышлению: документ содержит " & _

ActiveDocument.Paragraphs.Count & " абзацев."

For i = 1 To ActiveDocument.Paragraphs.Count


ActiveDocument.Paragraphs(i).Range.Select

'MsgBox Left(Selection.Text, 7)

If Left(Selection.Text, 5) Like "#.#*." _

Or Left(Selection.Text, 6) Like "#.##*." _

Or Left(Selection.Text, 4) Like "#.#." _

Or Left(Selection.Text, 5) Like "#.##." _

Or Left(Selection.Text, 6) Like "##.#*." _

Or Left(Selection.Text, 7) Like "##.##*." _

Or Left(Selection.Text, 5) Like "##.#." _

Or Left(Selection.Text, 6) Like "##.##." _

Then

Set myRange = ActiveDocument.Range( _

Start:=ActiveDocument.Paragraphs(i).Range.Start, _

End:=ActiveDocument.Paragraphs(i).Range.End)

myRange.Style = "Абзац0пт1пт"

For j = 1 To ActiveDocument.Paragraphs(i).Range.Words.Count

w = ActiveDocument.Paragraphs(i).Range.Words(j)

MsgBox w

ActiveDocument.Paragraphs(i).Range.Words(j).Select

If (w Like "#") Or (w Like "##") Or (w = ".") Or (w = "*.") Then

' Selection.Font.Bold = wdToggle

Selection.Font.Bold = True

ElseIf (w Like "*.?") Or (w Like ".?") Or (w Like ".??") Or (w Like "*.??") Then

Selection.Font.Bold = True

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t^t"

End With

Else

GoTo 1

End If

Next j

End If

1:

'MsgBox i

Next i

MsgBox "Ох и утомили ерундой. Привет!"


End Sub

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Sub СтильДляСпискаБезЛатыни()

'

' СтильДляСписка Макрос

' Макрос записан 02.04.2003 Grom

'

'If MsgBox("Открыть документ?", vbYesNo) = vbYes Then Dialogs(wdDialogFileOpen).Show

'MsgBox "Информация к размышлению: документ содержит " & _

ActiveDocument.Paragraphs.Count & " абзацев."

For i = 1 To 2

'ActiveDocument.Paragraphs.Count

ActiveDocument.Paragraphs(i).Range.Select

'MsgBox Left(Selection.Text, 7)

If Left(Selection.Text, 4) Like "[а-я])?[А-Я]" _

Or Left(Selection.Text, 5) Like "?[а-я])?[А-Я]" _

Or Left(Selection.Text, 5) Like "[а-я])??[А-Я]" _

Or Left(Selection.Text, 5) Like "[а-я])??[а-я]" _

Or Left(Selection.Text, 6) Like "[а-я])???[А-Я]" _

Or Left(Selection.Text, 6) Like "[а-я])???[а-я]" _

Or Left(Selection.Text, 5) Like "[а-я])*?[А-Я]" _

Or Left(Selection.Text, 5) Like "[а-я])*?[а-я]" _

Then

Set myRange = ActiveDocument.Range( _

Start:=ActiveDocument.Paragraphs(i).Range.Start, _

End:=ActiveDocument.Paragraphs(i).Range.End)

myRange.Style = "СписокПильщикова"

For j = 1 To 3

'ActiveDocument.Paragraphs(i).Range.Words.Count

w = ActiveDocument.Paragraphs(i).Range.Words(j)

MsgBox w

ActiveDocument.Paragraphs(i).Range.Words(j).Select

Selection.Collapse Direction:=wdCollapseStart

If (j = 1) And w = Chr(32) Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:="^t", ReplaceWith:=""


End With

End If

If (w Like ")?") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If

If (w Like ")[*]?") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If

If (w Like ")??") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If

If (w Like ")???") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If


Next j

End If

1:

'MsgBox i

Next i

MsgBox "Ох и утомили ерундой. Привет!"


End Sub

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Sub СтильДляСписка()

'

' СтильДляСписка Макрос

' Макрос записан 02.04.2003 Grom

'

If MsgBox("Открыть документ?", vbYesNo) = vbYes Then Dialogs(wdDialogFileOpen).Show

MsgBox "Информация к размышлению: документ содержит " & _

ActiveDocument.Paragraphs.Count & " абзацев."

For i = 1 To ActiveDocument.Paragraphs.Count


'MsgBox Left(Selection.Text, 7)

If Left(Selection.Text, 3) Like "[а-я])?" _

Or Left(Selection.Text, 4) Like "?[а-я])?" _

Or Left(Selection.Text, 4) Like "[а-я])??" _


Or Left(Selection.Text, 4) Like "[а-я])??" _

Or Left(Selection.Text, 5) Like "[а-я])???" _

Or Left(Selection.Text, 5) Like "[а-я])???" _

Or Left(Selection.Text, 4) Like "[а-я])*?" _

Or Left(Selection.Text, 4) Like "[а-я])*?" _

Then

Set myRange = ActiveDocument.Range( _

Start:=ActiveDocument.Paragraphs(i).Range.Start, _

End:=ActiveDocument.Paragraphs(i).Range.End)

myRange.Style = "СписокПильщикова"

For j = 1 To 3

'ActiveDocument.Paragraphs(i).Range.Words.Count

w = ActiveDocument.Paragraphs(i).Range.Words(j)

'MsgBox w

ActiveDocument.Paragraphs(i).Range.Words(j).Select

Selection.Collapse Direction:=wdCollapseStart

If (j = 1) And w = Chr(32) Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:="^t", ReplaceWith:=""

End With

End If

If (w Like ")?") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If

If (w Like ")[*]?") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If

If (w Like ")??") Then

With Selection.Find

.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If

If (w Like ")???") Then

With Selection.Find


.ClearFormatting

.MatchWholeWord = True

.MatchCase = False

.Execute FindText:=" ", ReplaceWith:="^t"

GoTo 1

End With

End If


Next j

End If

1:

'MsgBox i

Next i

MsgBox "Ох и утомили ерундой. Привет!"


End Sub


<< предыдущая страница   следующая страница >>