Sei sulla pagina 1di 4

'Public Sub Pedro()

' LIGA/DESLIGA O IT�LICO/NEGRITO A SELE��O => wdToggle muda de ligado para


desligado e vice versa
'Selection.Font.Italic = wdToggle
'Selection.Font.Bold = wdToggle

' TORNA NEGRITO ou IT�LICO, INDEPENDENTE DO ESTADO ANTERIOR


'Selection.font.Bold = True
'Selection.Font.Italic = True
'Selection.Font.Bold = True
'Selection.Font.Italic = False
'Selection.Font.Bold = False

' D� UM ENTER
'Selection.TypeParagraph
' ESCREVE UM TEXTO
'Selection.TypeText Text:="Pedro Massao Favaro Nakashima"
'ou
'Selection.TypeText "Pedro Massao Favaro Nakashima"

'ADICIONA UM NOVO DOCUMENTO � COLE��O DE DOCUMENTOS ABERTOS


'Documents.Add DocumentType:=wdNewBlankDocument
'ADICIONA O DOCUMENTO Pedro.docx � COLE��O DE DOCUMENTOS ABERTOS
'Documents.Add "Pedro.docx"
' WITH economiza nota��o. Toda linha que segue � tratada como se fosse come�ada com
Selection.Font
'With Selection.Font
' .Size = 14
' .Bold = True
' .Italic = True
'End With
' Guardar texto em uma vari�vel e depois escrever
'meutexto = "Pedro Massao Favaro Nakashima"
'Selection.TypeText meutexto

'Guardar n�mero em uma vari�vel, fazer conta e depois escrever


'preco = 100
'preco = preco * 1.2
'Selection.TypeText preco

'salariobase = 60000
'aumento = 0.025
'novosalario = salariobase + (salariobase * aumento)
'Selection.TypeText "O seu novo sal�rio � " & novosalario

'mensagemdetexto = "Essa opera��o pode levar v�rios minutos para ser completada. "
'mensagemdetexto = mensagemdetexto & vbNewLine & "Por favor, espere..." 'est�
usando o & para combinar strings (concatena��o)
' vbCrLf coloca uma nova linha
'Selection.TypeText mensagemdetexto
' DECLARANDO VARI�VEIS
'Dim sNames(19) As String
' CAIXA DE MENSAGEM
'MsgBox "Pedro Massao Favaro Nakashima", vbApplicationModal, "Aqui vai o t�tulo"
' CAIXA DE MENSAGEM DE INPUT + regra de decis�o
'IResult = MsgBox("Essa opera��o pode demorar um pouco. Continuar?", vbYesNo +
vbQuestion)
' CAIXA DE MENSAGEM DE INPUT + regra de decis�o -> OUTRO EXEMPLO
'Dim intResult As Integer
'MsgBox "Este � um exemplo de msgbox"
'MsgBox "Este � um exemplo de msgbox", vbCritical, "T�tulo da msgbox"
'intResult = MsgBox("Voc� quer continuar?", vbYesNo)
'If intResult = vbYes Then
' MsgBox "Aproveite o restante do programa"
'Else
' MsgBox "Obrigado por usar o programa. Te vejo na pr�xima vez!"
'End If
' INPUT BOX
'Dim txtseunome As String
'txtseunome = InputBox("Qual � o seu nome?", "Informa��o do usu�rio", "Pedro")
'MsgBox "Ol�, " & txtseunome
'Selection.TypeText txtseunome & " ama Simone"

'End Sub

'Sub DeleteTableRow()
'If Selection.Information(wdWithInTable) = True Then
' Selection.SelectRow
' Selection.Rows.Delete
'Else
' MsgBox "Coloque a porra do cursor na tabela"
'End If
'End Sub

'Sub SalesTax()
'Dim txtState As String
'Dim txtOutput As String
'txtState = InputBox("Em qual estado voc� mora?", "Imposto do Estado", "escolha")
'txtState = UCase(txtState)
'
'Select Case txtState
' Case "RS", "SC", "PR"
' txtOutput = "Por favor, inclua 1% de imposto sobre as vendas"
' Case "SP", "RJ", "MG", "ES"
' txtOutput = "Por favor, inclua 2% de imposto sobre as vendas"
' Case "MS", "MT", "GO"
' txtOutput = "Por favor, inclua 3% de imposto sobre as vendas"
' Case Else
' txtOutput = "Para estados petistas, como " & txtState & ", o imposto � de
100%"
'End Select
'Selection.TypeText txtOutput
'End Sub

'Sub primeiroloop()
'For contador = 5 To 10
'texto = contador
'Selection.TypeParagraph
'Selection.TypeText texto
'Next contador
'End Sub

'cria outro documento, tabela..


'Sub CharacterSet()
' Dim intCounter As Integer
' Documents.Add DocumentType:=wdNewBlankDocument
' ActiveDocument.Tables.Add Range:=Selection.Range, _
' numrows:=1, _
' numcolumns:=2, _
' DefaultTableBehavior:=wdWord9TableBehavior, _
' AutoFitBehavior:=wdAutoFitContent 'inicialmente h� 1 linha e 2 colunas
' Selection.TypeText Text:="number"
' Selection.MoveRight unit:=wdCell
'
' For intCounter = 32 To 255
' Selection.TypeText intCounter
' Selection.MoveRight unit:=wdCell
' Selection.TypeText Chr(intCounter)
' If intCounter < 255 Then
' Selection.MoveRight unit:=wdCell
' End If
' Next intCounter
'End Sub

'usando o DO WHILE ... LOOP


'Sub primeirodowhile()
'x = 5
'Do While x < 10
'x = x + 1
'Selection.TypeParagraph
'Selection.TypeText x
'Loop
'End Sub

'MACRO QUE N�O DEU CERTO:


'Sub FormatAll()
' Selection.HomeKey wdStory
' Selection.Find.ClearFormatting
' With Selection.Find
' .Text = "employee"
' .Replacement.Text = ""
' .Forward = True
' .Wrap = wdFindAsk
' .Format = False
' .MatchCase = False
' .MatchWholeWord = False
' .MatchWildcards = False
' .MatchSoundsLike = False
' .MatchAllWordForms = False
' End With
' Do While Selection.Find.Found
' Selection.Words.Underline = wdUnderlineSingle
' Selection.Find.Execute
' Loop
'End Sub

'tamb�m n�o deu certo


'Sub testeforeach()
'For Each w In Selection.Words
' MsgBox x
'Next x
End Sub

Potrebbero piacerti anche