Visual Basic para Aplicaciones - controlar word desde excel

Life is soft - evento anual de software empresarial
 
Vista:

controlar word desde excel

Publicado por sroque42 (2 intervenciones) el 14/01/2012 18:35:45
Buenas tardes
Estoy intentando exportar unas celdas de excel a word y lo he conseguido pero ahora quiero centrarlas en el word y ponerlas en negrita y no hay manera, alguien me podria ayudar??
Por favor Muchas gracias de antemano

Sub proWord()
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

.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


Esta es parte del codigo pero no hace nada de poner negrita
Un saludo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder