Skip to content

Instantly share code, notes, and snippets.

@tombrad
Created February 13, 2013 02:14
Show Gist options
  • Save tombrad/4880005 to your computer and use it in GitHub Desktop.
Save tombrad/4880005 to your computer and use it in GitHub Desktop.
Curso VBA-11
‘ Programa para llenar automáticamente un formulario en word
‘ Lo que está escrito con comilla simple son solo comentarios para explicar el programas, pueden omitirse
‘ With… EndWith sirve para no tener que repetir la misma instrucción en cada línea, en este caso Selection
With Selection
.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle ‘Coloca espacio de líneas en “espacio simple”
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.Font.Bold = True ‘Coloca negrita
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.Font.Size = 16 ‘Coloca tamaño de letra en 16
.ParagraphFormat.Alignment = wdAlignParagraphCenter ‘Alineado al centro
.TypeText Text:=”CERTIFICADO” ‘Escribe texto
.Font.Size = 12 ‘Coloca tamaño de letra en 12
.TypeParagraph ‘Pasa a linea siguiente
.Font.Bold = False ‘Desactiva negrita
.ParagraphFormat.Alignment = wdAlignParagraphLeft ‘alineacion a la izquierda
.TypeParagraph ‘Pasa a linea siguiente
.TypeText Text:=”Certifico que el señor “ ‘Escribe texto
.Font.Bold = True ‘Activa las negritas ‘Escribe texto
.TypeText Text:=TextBox1.Text ‘Escribe el contenido de textbox1.text
.Font.Bold = False ‘Desactiva las negritas
.TypeText Text:=”, domciliado en “ ‘Escribe texto
.TypeText Text:=TextBox2.Text ‘Escribe el contenido de textbox2.text
.TypeText Text:=” teléfono “ ‘Escribe texto
.TypeText Text:=TextBox3.Text ‘Escribe el contenido de textbox3.text
.TypeText Text:=” es una persona honorable, de buenas costumbres, “ ‘Escribe texto
.TypeText Text:=” que no consume alcohol y su comportamiento moral es intachable.” ‘Escribe texto
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeText Text:=” Se extiende el presente certificado a petición “ ‘Escribe texto
.TypeText Text:=” del interesado con objeto de su postulación al Opus Dei” ‘Escribe texto
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.Font.Name = “Arial” ‘Cambia el font a Arial
.Font.Size = 10 ‘Coloca tamaño en 10
.TypeText Text:=”Arica “ ‘Escribe texto
.TypeText Text:=Date$ ‘Escribe la fecha
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.TypeParagraph ‘Pasa a linea siguiente
.ParagraphFormat.Alignment = wdAlignParagraphCenter ‘Alineación al centro
.Font.Bold = True ‘Activa negritas
.TypeText Text:=” RR. PP. TOMAS BRADANOVIC S.J. “ ‘Escribe texto
.Font.Bold = False ‘Desactiva negritas
End With ‘Termina el ciclo Selection
Unload UserForm1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment