Good night
Sorry, but my english is not so good
I´m trying by vba code in excel, export same cells to word, this i gat it
But now I want to change the format, change the bold an center the text but i can´t
Could you help me please??
Thank you very much
this is my code
Dim Tag As String
Dim varDoc As Object
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim objSelection As Object
Tag = InputBox("Ingrese TAG")
Range("D2").Select
Set varDoc = CreateObject("Word.Application")
varDoc.Visible = True
'Sheets("Sheet1").Range("A1:B1").Copy
varDoc.Documents.Add
'varDoc.Selection.Paste
'varDoc.activedocument.SaveAs ThisWorkbook.Path & "/" & "testWord.doc"
'varDoc.documents.Close
'varDoc.Quit
Application.CutCopyMode = False
Set objSelection = varDoc.Selection
With objSelection
' formato de fuente para el título
.Font.Name = "Verdana"
.Font.Size = "16" ' tamaño
.Font.Bold = True
.TypeText "INFORME HISTORICO DE EQUIPO" ' agrega
' agrega dos parrafos
.TypeParagraph
.TypeParagraph
' formato para el texto del parrafo 1
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Font.Size = "12"
.Font.Color = vbBlue ' color de la fuente
' método TypeText para escribir el texto
Do Until Selection.Value = ""
b = Selection.Value
If b = Tag Then
a = Selection.Offset(0, -3).Value
c = Selection.Offset(0, 1).Value
d = Selection.Offset(0, -3).Value
e = Selection.Offset(0, -3).Value
varDoc.Selection.InsertAfter a
varDoc.Selection.InsertAfter " "
varDoc.Selection.moveright
varDoc.Selection.InsertAfter c
varDoc.Selection.InsertAfter " "
varDoc.Selection.moveright
varDoc.Selection.TypeParagraph
Selection.Offset(1, 0).Select
Else
Selection.Offset(1, 0).Select
End If
Loop
.Font.Color = vbBlack
.Font.Size = 8
.Font.Bold = True
.TypeText "Documento creado el : " & Date
End With
varDoc.Selection.Font.Size = 20
varDoc.Selection.InsertAfter "INFORME HISTORICO DE EQUIPO"
varDoc.Selection.WholeStory
varDoc.Selection.Font.Bold = wdToggle
varDoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
varDoc.Selection.moveright
varDoc.Selection.TypeParagraph
varDoc.Selection.InsertAfter Tag
varDoc.Selection.moveright
varDoc.Selection.TypeParagraph
varDoc.Selection.TypeParagraph
varDoc.Selection.Font.Size = 14
varDoc.Selection.Font.Bold = wdToggle
varDoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
varDoc.Selection.InsertAfter "ORDEN TRABAJO "
varDoc.Selection.InsertAfter "DESCRIPCION "
varDoc.Selection.moveright
varDoc.Selection.TypeParagraph
Bookmarks