
03/04/2008, 02:13
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 36
Antigüedad: 17 años, 6 meses Puntos: 0 | |
Re: Mediante V.B 6.0 introducir en el encabezado de un Word texto Aunque lo de alinear la tabla entera hacia un lado u otro sigue sin tirarme...
El código me queda así:
Dim Documento As New Word.Application
With Documento
'abre un documento
.Application.Documents.Open App.Path & "\Plan.doc"
'final del documento
.Application.Selection.EndKey wdStory
'Activar el encabezado
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
'Para que en todos los encabezados sea igual
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = CentimetersToPoints(0.95)
.BottomMargin = CentimetersToPoints(1.27)
.LeftMargin = CentimetersToPoints(1.59)
.RightMargin = CentimetersToPoints(1.63)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1)
.FooterDistance = CentimetersToPoints(0.78)
.PageWidth = CentimetersToPoints(21)
.PageHeight = CentimetersToPoints(29.7)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
'Alinear el texto a la derecha en el encabezado
.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Sections(1).Headers(wdHeaderFo oterPrimary).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
'intro
'crear tabla
.Documents.Item(1).Tables.Add Documento.Application.Selection.Range, 3, 3
Documento.Selection.Tables(1).Cell(1, 1).Borders(wdBorderTop).Visible = True
Documento.Selection.Tables(1).Cell(1, 1).Borders(wdBorderLeft).Visible = True
Documento.Selection.Tables(1).Cell(1, 1).Borders(wdBorderBottom).Visible = True
Documento.Selection.Tables(1).Cell(1, 1).Borders(wdBorderRight).Visible = True
Documento.Selection.Tables(1).Cell(1, 2).Borders(wdBorderTop).Visible = True
Documento.Selection.Tables(1).Cell(1, 2).Borders(wdBorderLeft).Visible = True
Documento.Selection.Tables(1).Cell(1, 2).Borders(wdBorderBottom).Visible = True
Documento.Selection.Tables(1).Cell(1, 2).Borders(wdBorderRight).Visible = True
Documento.Selection.Tables(1).Cell(2, 1).Borders(wdBorderTop).Visible = True
Documento.Selection.Tables(1).Cell(2, 1).Borders(wdBorderLeft).Visible = True
Documento.Selection.Tables(1).Cell(2, 1).Borders(wdBorderBottom).Visible = True
Documento.Selection.Tables(1).Cell(2, 1).Borders(wdBorderRight).Visible = True
Documento.Selection.Tables(1).Cell(2, 2).Borders(wdBorderTop).Visible = True
Documento.Selection.Tables(1).Cell(2, 2).Borders(wdBorderLeft).Visible = True
Documento.Selection.Tables(1).Cell(2, 2).Borders(wdBorderBottom).Visible = True
Documento.Selection.Tables(1).Cell(2, 2).Borders(wdBorderRight).Visible = True
'relleno de tabla
Documento.Selection.Tables(1).Cell(1, 1).Range.Text = "Cuestionario"
Documento.Selection.Sections(1).Headers(wdHeaderFo oterPrimary).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Tables(1).Cell(2, 1).Range.Text = "Nº Página"
Documento.Selection.Sections(1).Headers(wdHeaderFo oterPrimary).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Tables(1).Cell(1, 2).Range.Text = numinicio
Documento.Selection.Sections(1).Headers(wdHeaderFo oterPrimary).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
Documento.Selection.Tables(1).Cell(2, 2).Range.Text = numpaginas
Documento.Selection.Sections(1).Headers(wdHeaderFo oterPrimary).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
'mostramos documento
.Application.Visible = True
End With
Set Documento = Nothing
Como ves e puesto esa línea de código q me dijiste pero no me mueve la tabla
??????? |