Шпаргалка по "Программированию"
Автор: iftikhor2000 • Декабрь 17, 2021 • Шпаргалка • 624 Слов (3 Страниц) • 229 Просмотры
Билет№1:
Dim myRange As Range
Set myRange = Selection.Range
myRange.Find.Execute FindText:="^w", ReplaceWith:=" ", Replace:=wdReplaceAll
Билет№2:
Dim myRange As Range
Set myRange = Selection.Range
myRange.Find.Execute FindText:=" ", ReplaceWith:="_", Replace:=wdReplaceAll
Билет№3
Dim s As String
Dim t As Integer
Dim ans As String
t = -1
ans = ""
For i = 1 To ActiveDocument.Range.Characters.Count
If ActiveDocument.Range.Characters(i) = " " Then
ans = ans + " "
t = 1
Else
If t = 1 Then
t = -1
ans = ans + UCase(ActiveDocument.Range.Characters(i))
Else
ans = ans + ActiveDocument.Range.Characters(i)
End If
End If
Next i
ActiveDocument.Content.Text = ans
Билет№4
Dim counter As Integer
counter = 0
For i = 1 To ActiveDocument.Range.Characters.Count - 1
If Asc(ActiveDocument.Range.Characters(i)) >= Asc("0") And Asc(ActiveDocument.Range.Characters(i)) <= Asc("9") Then
counter = counter + 1
End If
Next
MsgBox (counter)
Билет№5
Dim counter As Integer
counter = 0
Dim str As String
For i = 1 To ActiveDocument.Words.Count - 1
str = Trim(ActiveDocument.Words(i))
counter = counter + 1
If counter Mod 2 = 0 Then
ActiveDocument.Words(i).Font.ColorIndex = wdRed
Else
ActiveDocument.Words(i).Font.ColorIndex = wdBlue
End If
Next
Билет№8
Dim k As Integer
k = 0
For i = 1 To ActiveDocument.Range.Characters.Count
If ActiveDocument.Range.Characters(i) >= "A" And ActiveDocument.Range.Characters(i) <= "Z" Then
k = k + 1
End If
If ActiveDocument.Range.Characters(i) >= "A" And ActiveDocument.Range.Characters(i) <= "Я" Then
k = k + 1
End If
Next i
MsgBox Str(k)
Билет№9
Dim counter As Integer
Dim ans As String
ans = ""
For i = 1 To ActiveDocument.Range.Characters.Count
If ActiveDocument.Range.Characters(i) = " " Then
ans = ans + " "
Else
If i Mod 2 = 0 Then
ans = ans + UCase(ActiveDocument.Range.Characters(i))
Else
If i Mod 2 <> 0 Then
...