You are on page 1of 3

1)Renomear os options Butons em: Alin_A a Alin_F

Public vCNS as String


Public vAlin_A as String
Public vAlin_B as String
Public vAlin_C as String
Public vAlin_D as String
Public vAlin_E as String
Public vAlin_F as String

''''''''''''''''''''''''''''''''''''''''''''''''''
sVar ()
vCNS = ""
vAlin_A = ""
vAlin_B = ""
vAlin_C = ""
vAlin_D = ""
vAlin_E = ""
vAlin_F = ""
''''''''''''''''''''''''''''''''''''''''''''''''''
sDat ()
''''''''''''''''''''''''''''''''''''''''''''''''''
sAlinea ()

DIM vAlin as String

If Alin_A Then
vAlin = MSG & vCNS & vAlin_A
ElseIf Alin_B Then
vAlin = MSG & vCNS & vAlin_B
ElseIf Alin_C Then
vAlin = MSG & vCNS & vAlin_C
ElseIf Alin_D Then
vAlin = MSG & vCNS & vAlin_D
ElseIf Alin_E Then
vAlin = MSG & vCNS & vAlin_E
ElseIf Alin_F Then
vAlin = MSG & vCNS & vAlin_F
Else Then
End IF

''''''''''''''''''''''''''''''''''''''''''''''''''
sGravar ()

If

''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Editar_TB ()
Dim Code As String
If TextBox1.Text.Contains("<header>") Then
Code = TextBox1.Text.SubString _
(TextBox1.Text.IndexOf("<header>"), _
TextBox1.Text.IndexOf("</header>") _
TextBox1.Text.IndexOf("<header>"))
ElseIf TextBox1.Text.Contains("<código 2>") Then
End If
''''''''''''''''''''''''''''''''''''''''''''''''''

Sub TextBoxReplace() '


Dim xWs As Worksheet
Dim shp As Shape
Dim xFindStr As String
Dim xReplace As String

xFindStr = Application.InputBox("Find:", xTitleId, "", Type:=2)


xReplace = Application.InputBox("Replace:", xTitleId, "", Type:=2)
Set xWs = Application.ActiveSheet
On Error Resume Next
For Each shp In xWs.Shapes
xValue = shp.TextFrame.Characters.Text
shp.TextFrame.Characters.Text = VBA.Replace(xValue, xFindStr, xReplace, 1)
Next
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Substituir ()

Dim vSubst as String

vProuc = "Rafael"
vSubst = "Rf"

For Each text in Nom


xValue = Nom.Characters.Text
Nom.Characters.Text = VBA.Replace(xValue, vSubst, xReplace, 1)
Next

End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''
TextBox1.SelStart = 0
TextBox1.SelLength = VBA.Len(TextBox1.Text)

Objetos necessários:
1 CommandButton com o nome CmdProcura
2 text box:
Um com o Name=txtTexto e o outro com txtProcura

''''''''''''''''''''''''''''''''''''''''''''''''''

Dim vChar As Integer

Private Sub cmdProcura_Click()

Dim vPal As Integer 'retorna o tamanho da palavra a localizar


vPal = Len(txtProcura.Text)

For a = vChar To Len(txtTexto.Text) ' retorna o tamanho do texto


If UCase(Mid$(txtTexto.Text, a, vPal)) = UCase(txtProcura) Then
vChar = a + 1
txtTexto.SetFocus
txtTexto.SelStart = a - 1
txtTexto.SelLength = vPal
Exit Sub
End If
Next

MsgBox "Não foi encontrada nenhuma palavra!"


vChar = 1
End Sub

Private Sub Form_Load()


vChar = 1
End Sub

A forma de selecionar os últimos 7 caracteres é simples, e você pode recuperar essa


informação de forma simples através do atributo SelectedText, como no exemplo
abaixo.

var numeroDeCaracteres = 7; var startIndex = textBox1.Text.Length -


numeroDeCaracteres; textBox1.SelectionStart = startIndex; textBox1.SelectionLength
= numeroDeCaracteres;

You might also like