antonio_pedro

TESTE MSW COLOR TEXT

May 17th, 2026
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 0.93 KB | Source Code | 0 0
  1. Sub FormatarMaterialJuridico()
  2.     Dim rng As Range
  3.     Set rng = ActiveDocument.Content
  4.    
  5.     Application.ScreenUpdating = False
  6.    
  7.     With rng.Find
  8.         .ClearFormatting
  9.         .Replacement.ClearFormatting
  10.        
  11.         ' Procura pelo padrão [V]texto[/V] usando caracteres curinga
  12.        .Text = "\[V\](*)\[/V\]"
  13.         .Replacement.Text = "\1"
  14.         .MatchWildcards = True
  15.         .Forward = True
  16.         .Wrap = wdFindContinue
  17.        
  18.         ' Aplica a formatação exata do seu padrão visual
  19.        .Replacement.Font.Color = RGB(255, 0, 0) ' Cor Vermelha
  20.        .Replacement.Font.Underline = wdUnderlineSingle ' Sublinhado
  21.        
  22.         ' Executa a substituição em todo o documento de uma vez só
  23.        .Execute Replace:=wdReplaceAll
  24.     End With
  25.    
  26.     Application.ScreenUpdating = True
  27.     MsgBox "Seu material foi formatado com sucesso!", vbInformation, "Automação Concluída"
  28. End Sub
  29.  
Advertisement
Add Comment
Please, Sign In to add comment