-
Notifications
You must be signed in to change notification settings - Fork 0
/
Word-ConversorMaiusculaMinuscula.bas
74 lines (63 loc) · 2.32 KB
/
Word-ConversorMaiusculaMinuscula.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Attribute VB_Name = "Módulo1"
Sub WordConversor_minuscula_MAIUSCULA()
' Define as letras minúsculas e suas correspondentes maiúsculas
letrasMai = "AÁÂÃBCÇDEÉÊFGHIÍÎJKLMNOÓÔÕPQRSTUÚÛÜVWXYZ"
letrasMin = "aáâãbcçdeéêfghiíîjklmnoóôõpqrstuúûüvwxyz"
N = 1
' Desligando atualização de tela para aumentar o desempenho
Application.ScreenUpdating = False
' Loop para converter
Do While lmin <> "z"
LMAI = Right(Left(letrasMai, N), 1)
lmin = Right(Left(letrasMin, N), 1)
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = lmin
.Replacement.Text = LMAI
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
N = N + 1
Loop
' Ligando ativação de tela novamente
Application.ScreenUpdating = True
End Sub
Sub WordConversor_MAIUSCULA_minuscula()
' Define as letras minúsculas e suas correspondentes maiúsculas
letrasMai = "AÁÂÃBCÇDEÉÊFGHIÍÎJKLMNOÓÔÕPQRSTUÚÛÜVWXYZ"
letrasMin = "aáâãbcçdeéêfghiíîjklmnoóôõpqrstuúûüvwxyz"
N = 1
' Desligando atualização de tela para aumentar o desempenho
Application.ScreenUpdating = False
' Loop para converter
Do While lmin <> "z"
LMAI = Right(Left(letrasMai, N), 1)
lmin = Right(Left(letrasMin, N), 1)
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = LMAI
.Replacement.Text = lmin
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
N = N + 1
Loop
' Ligando ativação de tela novamente
Application.ScreenUpdating = True
End Sub